Is that JSON invalid? Is that JSON invalid? json json

Is that JSON invalid?


$.getJSON() is an async function. You cannot do

var data = $.getJSON("http://ocart.com/index.php?route=ajaxhelper/test&product_id=" + product_id);return data;

Instead, you have to process the results when it comes back:

$.getJSON("http://ocart.com/index.php?route=ajaxhelper/test&product_id=" + product_id)    .then(function(data){        //Do what you need to do with data    });