javascript - Invalid characters in json response -
i unable process json response ,while accessing json response getting invalid characters in json response,so how can remove white space issues , invalid characters json response using php scirpt
my json response :
[{"keyword":"cosmetic dermatology","svol":4400},{"keyword":"dermatology associates","svol":22200},{"keyword" :"advanced dermatology","svol":40500},{"keyword":"dermatology clinic","svol":3600},{"keyword":"dermatology specialists","svol":3600},{"keyword":"dermatology consultants","svol":5400},{"keyword":"pediatric dermatology" ,"svol":3600},{"keyword":"what dermatology","svol":1900},{"keyword":"dermatology pictures","svol" :1300},{"keyword":"dermatological","svol":2400},{"keyword":"laser dermatology","svol":1300},{"keyword" :"dermatology group","svol":1900},{"keyword":"dermatology uk","svol":390},{"keyword":"dermatology courses" ,"svol":1000},{"keyword":"dermatologic","svol":1600},{"keyword":"westlake dermatology","svol":8100}, {"keyword":"pariser dermatology","svol":3600},{"keyword":"aesthetic dermatology","svol":1000},{"keyword" :"dermatology doctors","svol":590},{"keyword":"north dallas dermatology","svol":1300} ]
and jquery is:
$.ajax({ type:"post", datatype : 'json', url:"getkeywordbids.php", data:"specialty="+ spevalue, success: function(s) { var object = $.parsejson(s); /*otable.fncleartable(); otable.fnadddata([ s ]); */ } });
firebug output:
syntaxerror: json.parse: unexpected non-whitespace character after json data @ line 1 column 25230 of json data
and jsonlint.com output json response:
parse error on line 75: ... "keyword": "ear nose , throat ----------------------^ expecting 'string', 'number', 'null', 'true', 'false', '{', '['
you don't need use $.parsejson();
since datatype : 'json'
specified. returned data in json format use directly.
Comments
Post a Comment