php - Unable to post variables with jquery post -


this question exact duplicate of:

i trying pass variables modal form page. declare variables form id tags in each selection.

page reloads test.php, no variable can echoed.

javascript

var id = $( "#id" ), name = $( "#name" )  $.post("jqtest/test.php", { device_id: "id", device_name: "name" }); load('jqtest/test.php'); 

test.php

echo $_post['device_name']; echo $_post['device_id']; 

var id = $( "#id" ), name = $( "#name" ) /* if have tag <input id='id' value='abc'> , want abc , $( "#id" ).val();  if have tag <div id='id' >abc</div> , want abc,$( "#id" ).html(); */ $.post("jqtest/test.php", { device_id: "id", device_name: "name" }); /* after id , name , need $.post("jqtest/test.php", { device_id: id, device_name: name }); */  load('jqtest/test.php'); /*   useless delete line   if need callback, ref:   $.post("test.php", { name: "john", time: "2pm" })     .done(function(data) {     alert("data loaded: " + data);     }); */ 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -