[wd_asp elements=’search’ ratio=’100%’ id=1]

Basic Post Multiple data via ajax

25th April 2014

Jquery - Ajax

jquery icon

This sends two pieces of data

Create two variables called : – idno and newbudgetamount
They will send as a GET and be read like
myweb.com/page.php/?panelid=337&newbudgetamount=newbudgetamount

//ajax call
$.ajax({
url: "testpanelnum.php",
dataType: "html",
type: 'POST',
data: "panelid=" + idno+ "&newbudgetamount=" + newbudgetamount,
success: function(data){
$(".newbudgetresponse").html(data);
alert(data);
}
}); //end ajax

To send all form values

var formvars = $(“#form1”).serialize(); // add this
and change this : –
“data: “panelid=” + idno+ “&newbudgetamount=” + newbudgetamount,”
To this: – data: formvars,

And to send in json format which also works as simple POST
data: {accountid: accid , tagname: tagchose},