[jQuery] Passing multiple variables using .ajax()
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1"><big>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:</big>
</font>$.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:
<tt> <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></tt>
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
</body>
</html>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/