Multiple $.post duplicating results in DropDowns
If I use a single statement, then it works well. I mean if I use multiple $.post, as shown below, it fills both the DropDowns with the data of the second $.post. Why? The .php file contain开发者_C百科s code to dynamically fill DropDown.
$.post("../Lib/filldropdown.php",
{DropDownControlName: "inMemberOf", SqlQuery: "SELECT * FROM electioncategorymaster" },
function(data){
$('#divMemberOf').html(data);
});
$.post("../Lib/filldropdown.php",
{DropDownControlName: "inWard", SqlQuery: "SELECT * FROM wardconstituencymaster"},
function(data){
$('#divWard').html(data);
});
Kindly ignore the Sql Injection issue above.
Are you sure it's not a server caching issue? Open up FireBug and inspect the responses of the two POST requests. I have a feeling that you'll see that the second request is returning response data from the first request.
精彩评论