Reputation: 73
I'm getting the following error: missing : after property id in line
data:{$("#msgForm").serialize() + "&field=msg_from"}
The code looks like the following:
$("#msg_from").autocomplete({
source:
function (req, resp){
$.ajax({
url: "autocompl.asp",
data:{$("#msgForm").serialize() + "&field=msg_from"}
});
}
});
Any clue?
Upvotes: 4
Views: 2187
Reputation: 16091
in your case it should be:
data: $("#msgForm").serialize() + "&field=msg_from"
in other cases, when using {}
, you also need a key:
data: {'something': $("#msgForm").serialize() + "&field=msg_from"}
Upvotes: 5
Reputation: 146320
Your data should look like this:
data: $("#msgForm").serialize() + "&field=msg_from"
Upvotes: 2
Reputation: 66465
Remove the {
and }
from that line:
$("#msg_from").autocomplete({
source:
function (req, resp){
$.ajax({
url: "autocompl.asp",
data: $("#msgForm").serialize() + "&field=msg_from"
});
}
});
The {}
in data: {}
is interpreted as object literal, not a code block (terminology?). Object literals are in the form { id: property }
, hence the error message.
Upvotes: 3