Error: none: after property identifier

I get the following error: missing: after id of property in string

data:{$("#msgForm").serialize() + "&field=msg_from"} 

The code is as follows:

 $("#msg_from").autocomplete({ source: function (req, resp){ $.ajax({ url: "autocompl.asp", data:{$("#msgForm").serialize() + "&field=msg_from"} }); } }); 

Any clue?

+4
source share
3 answers

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"} 
+5
source

Remove { and } from this line:

 $("#msg_from").autocomplete({ source: function (req, resp){ $.ajax({ url: "autocompl.asp", data: $("#msgForm").serialize() + "&field=msg_from" }); } }); 

{} in data: {} interpreted as an object literal, not a block of code (terminology?). Object literals are of the form { id: property } , so an error message.

+3
source

Your data should look like this:

 data: $("#msgForm").serialize() + "&field=msg_from" 
+2
source

All Articles