Friday, 15 February 2013

ajax - jQuery JSONP parse error -



ajax - jQuery JSONP parse error -

i'm working on phonegap project uses jquery ajax info our online app.

here code using:

$.ajax({ type: 'get', url: home , async: false, datatype: "jsonp", jsonpcallback: 'jsoncallback', data: {action: 'get_survey', survey: survey_id}, success: function (result) { $.mobile.loading( 'hide', {}); display_survey(result); }, error: function (request,error) { $.mobile.loading( 'hide', {}); alert(error); } });

here info beingness returned server:

jsoncallback({"symptoms":{"ent":["does not pay attending details or makes careless mistakes wiht, example, homework","has difficulty keeping attending needs done","does not seem hear when spoken directly","does not follow through when given directions , fails finish activities (not due refusal or vailure understand)","has difficulty organizing tasks , activities","avoids, dislikes, or not want start tasks require ongoing mental effort","loses things necessary tasks or activities (toys, assignments, pencils or books","is distracted noises or other stimuli","is forgetful in daily activities","fidgets hands or feet or squirms in seat","leaves seat when remaining seated expected","runs or climbs much when remaining seated expected","has difficulty playing or origin quiet play activities","is 'on go' or acts if 'driven motor'","talks much","blurts out answers before questions have been completed","has difficulty waiting or turn","interrupts or intrudes on others' conversations and\/or activities","argues adults","loses temper","actively defies or refuses go along adults' requets or rules","deliberately annoys people","blames others or mistakes or misbehaviors","is touchy or annoyed others","is angry or resentful","is spiteful , wants even","bullies, threatens, or intimidates others","starts physical fights","lies out of problem or avoid obligations (ie, 'cons' others)","is truant school (skips school) without permission","is physically cruel people","has stolen things have value","deliberately destroys others' property","has used weapon can cause serious harm (bat, knife, brick, gun)","is physically cruel animals","has deliberately set fires cause damage","has broken else's home, business or car","has stayed out @ night without permission","has run away home overnight","has forced sexual activity","is fearful, anxious or worried","is afraid seek new things fear of making mistakes","feels worthless or inferior","blames self problems, feels guilty","feels lonely, unwanted or unloved; complains 'no 1 loves him or her'","is sad, unhappy or depressed","is self-conscious or embarrrassed"]},"performance":{"ent":["overall school performance","reading","writing","mathematics","relationship parents","relationship siblings","relationship wiht peers","participation in organized activities (eg, teams)"]}})

right now, testing app in browser. when pg app called same server online app, works fine. however, if pg app on different server, 'parseerror' jquery , error function triggerd.

however, when in console, can see pg app receiving of data.

am missing when set-up jsonp call?

i think need alter jsonpcallback:'jsonpcallback' bit jsonpcallback: function() { alert('foo'); }

jquery ajax jsonp

No comments:

Post a Comment