Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery AJAX JSONP error "Unexpected token"
    primarykey
    data
    text
    <p>I'm trying to make a cross domain <strong>JSONP</strong> call in Chrome, but the I keep getting back <strong>"Uncaught SyntaxError: Unexpected token :"</strong> I've tried: changing the response content type, setting xhr headers, JSON.stringify, just about most of the solutions offered on here but nothing worked so far :-(</p> <pre><code> $.ajax({ type: "POST", url: "https://www.virustotal.com/vtapi/v2/url/report", crossDomain: true, contentType: "application/json; charset=UTF-8", dataType: 'jsonp', data: { apikey: "*", resource: "http://www.1001freefonts.com/font/BaroqueScript.zip" }, jsonp: false, jsonpCallback: receive, success: function (data, textStatus, jqXHR) { console.log("Data retrieved: " + data); } }).done(function () { console.log('I think we are done here'); }) .error(function (e) { console.log(arguments); console.log('something went funny here'); }) .complete(function (xhr, status) { console.log("complete"); if (status === 'error' || !xhr.responseText) { console.log('error'); } else { console.log("data found:" + xhr.responseText); //... } }); }); function receive(saveData) { if (saveData == null) { console.log("DATA IS UNDEFINED!"); // displays every time } console.log("Success is " + saveData); // 'Success is undefined' } </code></pre> <p>In the debugger I can see the response</p> <pre><code>{"permalink": "https://www.virustotal.com/url/b5b546fdbb49a2258e951c5e568a52655c65ac56112e39d15af0954a53b36772/analysis/1360339512/", "url": "http://www.1001freefonts.com/font/BaroqueScript.zip", "response_code": 1, "scan_date": "2013-02-08 16:05:12", "scan_id": "b5b546fdbb49a2258e951c5e568a52655c65ac56112e39d15af0954a53b36772-1360339512", "verbose_msg": "Scan finished, scan information embedded in this object", "filescan_id": "b7e13c0242e9690aba1f3da4b73d9c2e99a9b7fd03f542b55e694a34aaf9eca8-1360339519", "positives": 0, "total": 35, "scans": {"CLEAN MX": {"detected": false, "result": "clean site"}, "MalwarePatrol": {"detected": false, "result": "clean site"}, "ZDB Zeus": {"detected": false, "result": "clean site"}, "K7AntiVirus": {"detected": false, "result": "clean site"}, "Quttera": {"detected": false, "result": "clean site"}, "Yandex Safebrowsing": {"detected": false, "result": "clean site"}, "MalwareDomainList": {"detected": false, "result": "clean site"}, "ZeusTracker": {"detected": false, "result": "clean site"}, "zvelo": {"detected": false, "result": "clean site"}, "Google Safebrowsing": {"detected": false, "result": "clean site"}, "BitDefender": {"detected": false, "result": "clean site"}, "Opera": {"detected": false, "result": "clean site"}, "G-Data": {"detected": false, "result": "clean site"}, "C-SIRT": {"detected": false, "result": "clean site"}, "Sucuri SiteCheck": {"detected": false, "result": "clean site"}, "VX Vault": {"detected": false, "result": "clean site"}, "ADMINUSLabs": {"detected": false, "result": "clean site"}, "SCUMWARE.org": {"detected": false, "result": "clean site"}, "Dr.Web": {"detected": false, "result": "clean site"}, "AlienVault": {"detected": false, "result": "clean site"}, "Malc0de Database": {"detected": false, "result": "clean site"}, "SpyEyeTracker": {"detected": false, "result": "clean site"}, "Phishtank": {"detected": false, "result": "clean site"}, "Avira": {"detected": false, "result": "clean site"}, "Antiy-AVL": {"detected": false, "result": "clean site"}, "Comodo Site Inspector": {"detected": false, "result": "clean site"}, "Malekal": {"detected": false, "result": "clean site"}, "ESET": {"detected": false, "result": "clean site"}, "SecureBrain": {"detected": false, "result": "unrated site"}, "Netcraft": {"detected": false, "result": "clean site"}, "ParetoLogic": {"detected": false, "result": "clean site"}, "URLQuery": {"detected": false, "result": "unrated site"}, "Wepawet": {"detected": false, "result": "unrated site"}, "Minotaur": {"detected": false, "result": "clean site"}}} </code></pre> <p>I've verified it on <a href="http://jsonlint.com/" rel="nofollow">http://jsonlint.com/</a> and it shows that it's a valid JSON.</p> <p>Here are the Response Headers</p> <pre><code>cache-control:no-cache content-encoding:gzip content-length:695 content-type:application/json date:Wed, 13 Feb 2013 12:00:33 GMT server:Google Frontend status:200 OK vary:Accept-Encoding version:HTTP/1.1 </code></pre> <p>Anyone have any ideas/suggestions?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload