jquery generate post entire page

Solutions on MaxInterview for jquery generate post entire page by the best coders in the world

showing results for - "jquery generate post entire page"
Fátima
15 Feb 2018
1function postData(actionUrl, method, data) {
2    var mapForm = $('<form id="mapform" action="' + actionUrl + '" method="' + method.toLowerCase() + '"></form>');
3    for (var key in data) {
4        if (data.hasOwnProperty(key)) {
5            mapForm.append('<input type="hidden" name="' + key + '" id="' + key + '" value="' + data[key] + '" />');
6        }
7    }
8    $('body').append(mapForm);
9    mapForm.submit();
10}
11
12var data= { 'property1': 666, 'property2': 'I am a boy' };
13postData('http://urltopostdata.to', 'post', data);
14
15