Trouble with JQuery calling webservices with parameters and getting data back
I have a JQuery template, and I want to call a webservice and populate the fields in it. The issues I am having are, I'm not sure how to pass parameters in my $.ajax call (ideally, I want to pass a dictionary so I can pass as many or few parameters as I want).
I tried data: { Key : Value }
but get a 500 server erro开发者_JAVA技巧r saying something about not a valid JSON primative.
Once the webservice is called, how can I get my data back in a JSON string that is compatible with a JQuery template? My webservices usually get a List and my jquery template works with a JSON object.
The problem is basically the format of data between client and server. Any ideas?
My webservice call works fine, it's simply a problem of JSON and data.
Edit: I have succeeded in calling the webservice with a dictionary, I am now trying to figure out how to get the data back. I'm getting a circular reference error.
You need JSON2.js from JSON.org.
Examples:
var myJSONObject = {"bindings": [
{"ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*"},
{"ircEvent": "PRIVMSG", "method": "deleteURI", "regex": "^delete.*"},
{"ircEvent": "PRIVMSG", "method": "randomURI", "regex": "^random.*"}
]
};
var myObject = JSON.parse(myJSONtext, reviver);
var myJSONText = JSON.stringify(myObject, replacer);
精彩评论