deadconversations deadconversations - 4 months ago 10x
SQL Question

AJAX - multiple data

I'm stuck: I'm trying to submit a form using AJAX, but I can't find a way to send multiple data fields via my AJAX call.

$(document).ready(function() {
$("#btnSubmit").click(function() {
var status = $("#activitymessage").val();
var name = "Ronny";
type: "POST",
url: "ajax/activity_save.php",
**data: "status="+status+"name="+name"**,
success: function(msg) {...

I've tried all sorts of stuff:

data: {status: status, name: name},

Or even stuff like this just for testing purposes:

data: "status=testing&name=ronny",

But whatever I try, I get nothing in my
thus nothing in my SQL.

So, what's the correct syntax to put more lines of data in my AJAX call?


The correct syntax is:

data: {status: status, name: name},

If that doesn't work I would alert those variables to make sure they have values.