load content with Jquery together with sending variable in to it -


i have variable - x in jquery, loading php part in div block , need sent variable it.

so -

$(document).on('click','#link',function () { var x=5; $("#block").load("file.php"); }); 

in result still in same page.i need have variable x in it.

i think use method or xmlhttprequest don't want page, need load php part in block.

one solution send data second argument:

$(document).on('click', '#link', function() {   $("#block").load("file.php", {     x: 5   }, function(res) {     //your callback    }); }); 

references

.load()


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -