javascript - Passing Multiple Variables to a PHP page -
i want pass multiple variables city1 , area1 (javascript variables) in url php page got stuck in on part shown below. doing wrong?
$("#list").load("selectcity.php?city1="+city1&"area1="+area1); $.ajaxsetup({ cache: false });
the & character should inside quotes , not outside quotes. corrected code :
$("#list").load("selectcity.php?city1="+city1+"&area1="+area1); $.ajaxsetup({ cache: false }); get parameters separated character &. passing 2 parameters file separated &. ? sign in url indicates next characters coming after get parameters.
or can use $.get easy set , works fine $.load :
$.get("selectcity.php", {"city1": city1, "area1": area1}, function(response){ $("#list").html(response); });
Comments
Post a Comment