Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery generate post entire page

function postData(actionUrl, method, data) {
    var mapForm = $('<form id="mapform" action="' + actionUrl + '" method="' + method.toLowerCase() + '"></form>');
    for (var key in data) {
        if (data.hasOwnProperty(key)) {
            mapForm.append('<input type="hidden" name="' + key + '" id="' + key + '" value="' + data[key] + '" />');
        }
    }
    $('body').append(mapForm);
    mapForm.submit();
}

var data= { 'property1': 666, 'property2': 'I am a boy' };
postData('http://urltopostdata.to', 'post', data);

Comment

PREVIOUS NEXT
Code Example
Javascript :: how to join kak in javascript 
Javascript :: js user add names to a list on screen 
Javascript :: bcrypt create encrypted password 
Javascript :: javascript extract json from string 
Javascript :: regular expression email 
Javascript :: convert boolean to string javascript 
Javascript :: input in html table 
Javascript :: nodejs curd insert update delete 
Javascript :: react set state before render 
Javascript :: index and id togtgher angularjs 
Javascript :: react testing library increase debug length 
Javascript :: str_limit function filter vuejs 
Javascript :: find element in array underscore js 
Javascript :: JavaScript: Updating Object Properties 
Javascript :: react native uid 
Javascript :: nested template strings js 
Javascript :: get value from serialized json apex 
Javascript :: angular size of array 
Javascript :: filter the falsy values out of an array in a very simple way! 
Javascript :: javascript set elements width by tag name 
Javascript :: split by space capital letter or underscore javascript 
Javascript :: number vs bigint js 
Javascript :: React: readmore and read less 
Javascript :: VS Code Auto Import is bugging usestate 
Javascript :: const { something} javascript 
Javascript :: how to use hammerjs in ionic 5 
Javascript :: ejs tutorial 
Javascript :: expected an identifier and instead saw const 
Javascript :: package.json merger 
Javascript :: alex morgan 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =