Also, if those values are coming from a form, use the serialize() method to create the string for you.
Rey... Christopher Jordan wrote: > Hi folks, > > I'm trying to make an ajax call using the .ajax() method, and I can't > figure out how to pass multiple variables. I've checked out the > interactive API (very cool by the way), and it shows an example like this: > > $.ajax({ > type: "POST", > url: "some.php", > data: "name=John&location=Boston", > success: function(msg){ > alert( "Data Saved: " + msg ); > } > }); > > > Since the type is set to post this should be using the form scope, but > the '&' leads me to think that it's passing information in the query > string. I'm a bit confused. I've tried passing multiple variables after > this fassion, and can't seem to get it right. > > My code: > > <script type="text/javascript" src="/include/js/jquery.js"></script> > <script type="text/javascript"> > $(document).ready(function(){ > var i,IDList; > IDList = "#ClientNumberList#"; > IDList = IDList.split("|"); > for(i = 0; i < IDList.length; i++){ > $.ajax({ > type: "POST", > url: "MyJQueryTest.cfm", > data: "ClientID=" + IDList[i] + "&Test=ChrisRocks", > dataType: "html", > success: function(msg){ > $("##foo" ).append(msg); > } > }); > } > }); > </script> > > > I thought I should have a variable called "Test" with a value of > "ChrisRocks" in it. hmm... can anyone explain what I'm missing here? > > Thanks, > Chris > > > ------------------------------------------------------------------------ > > _______________________________________________ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/