JQuery JSON error: syntax error, unrecognized expression

This is my first experience using JSON, so I'm probably doing something really dumb.

I created an application to clear pages and return a JSON object.

My JSON returned, looks like this (using Facebook as an example):

{"urlTitle":"Welcome to Facebook \u2014 Log in, sign up or learn more","urlDescription":" Facebook is a social utility that connects people with friends and others who work, study and live around them. People use Facebook to keep up with friends, upload an unlimited number of photos, post links and videos, and learn more about the people they meet."} 

However, in FireBug I get the above error (see also screenshot).

My jQuery code gets JSON via AJAX and looks simple:

 $("#submitButton").on("click", function(){ $.ajax({ url: '/miscellaneous/scrape/scrape.cfm', dataType: 'json', data: { strURL: $.param( $("#submitURL").attr("value") ) }, type: 'POST', success: function(data) { alert("yes!"); } }); return false; }); 

I never get a message about my success :( Just a mistake!

Am I doing something really obviously wrong here?

Thanks Michael.

enter image description here

EDIT

Here is my whole JSON as requested:

 {"urlTitle":"Welcome to Facebook \u2014 Log in, sign up or learn more","urlImages":{"image_8":"http:\/\/static.ak.fbcdn.net\/rsrc.php\/v2\/yb\/r\/GsNJNwuI-UM.gif","image_6":"http:\/\/photos-g.ak.fbcdn.net\/photos-ak-snc7\/v85005\/226\/255889644513526\/app_104_255889644513526_1061222291.png","image_7":"http:\/\/secure-us.imrworldwide.com\/cgi-bin\/m?ci=ent156564&am=3&ep=1&at=view&rt=banner&st=image&ca=cmp7747&cr=crv72918&pc=plc220331&r=1346702536","image_4":"http:\/\/photos-a.ak.fbcdn.net\/photos-ak-snc7\/v85006\/156\/156324174503268\/app_104_156324174503268_1504955413.png","image_5":"http:\/\/photos-b.ak.fbcdn.net\/photos-ak-snc7\/v85005\/78\/344521295633922\/app_104_344521295633922_1943760717.png","image_3":"http:\/\/photos-c.ak.fbcdn.net\/photos-ak-snc7\/v85005\/14\/298987460188718\/app_104_298987460188718_170436975.png","image_2":"http:\/\/photos-g.ak.fbcdn.net\/photos-ak-snc7\/v85006\/196\/287530028007964\/app_104_287530028007964_853932327.png","image_1":"http:\/\/static.ak.fbcdn.net\/rsrc.php\/v2\/yY\/r\/2LiCtrj0cdC.png"},"urlDescription":" Facebook is a social utility that connects people with friends and others who work, study and live around them. People use Facebook to keep up with friends, upload an unlimited number of photos, post links and videos, and learn more about the people they meet."} 
+6
source share
1 answer

Hey. Based on the comments on your question .. it looks like you are looking for a way to avoid AJAX requests for caching. For this you can try something like this.

 $.ajax({ url: url, data: inputs + '&ran=' + Math.rand(), )}; 

or

 $.ajaxSetup ({ // Disable caching of AJAX responses cache: false }); 

Hope this helps you.

0
source

Source: https://habr.com/ru/post/924474/


All Articles