tags:

views:

28

answers:

1

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 contains 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.

+1  A: 

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.

BBonifield
+1 with this. Caching is always PITA. Either the browser do it without your concern, or the server do it. Debugging with Firebug will save your day.
Donny Kurnia
@Donny: Anyway to removed cached data before filling the second DropDown?
RPK
It's depend, in where is the caching happened. Is it in your browser, or in the server. Have you try it in Firebug? What did you get there? Please report your result it here. If you have it in the hosting, you can put the URL here, so other member can test it out.
Donny Kurnia