Problem in sending JSON data to the yahoo server with POST message
I am trying this code in Javascript. But its not working.... The postD开发者_StackOverflow中文版ata is json data sent to the server to be saved. I have checked that JSON data needs to be parsed or stringify... is that the problem.. or I am doing some other silly mistake...
You have handleSuccess defined twice. The second time is a no-op. Get rid of the second 'var handleSuccess = ...' and put in a handleFailure definition.
Actually what you have even not JSON string. It is just invalid string. You need to put it in ''.
var postData ='_out=json&name=justtryit&def={"layout":[{"id":"sw-156","xy":[168,80]},{"id":"_OUTPUT","xy":[508.33331298828125,95.81666564941406]}],"modules":[{"type":"fetch","id":"sw-156","conf":{"URL":{"value":"www.sports.yahoo.com","type":"url"}}},{"type":"output","id":"_OUTPUT","conf":{}}],"terminaldata":[],"wires":[{"id":"_w1","src":{"id":"_OUTPUT","moduleid":"sw-156"},"tgt":{"id":"_INPUT","moduleid":"_OUTPUT"}}]}&rnd=7821&.crumb=P.r4cQGAC.Y';
It should work if you are doing right call
精彩评论