Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to do cross-domain jsonp request in javascript
    primarykey
    data
    text
    <p>i'm working on a little sample of code but i'm getting some problem to do what i want.</p> <p>here is a sample of code. i found part of it on internet and tryed to use it.</p> <p>in the case just above it works perfectly but when the target URL is not the same it doesent</p> <p>in the first example, the target provide json. in the second example, the target provide jsonp.</p> <p>the difference is that for the second example i set the json to the 'true' value. i don't really understand why it doesn't work.</p> <p>if someone could explain me that cause' i tried plenty of things that i found on internet but nothing really worked. </p> <p>thanks so much for those who will take some time on my problem and help me to figure out what's wrong ;)</p> <p>sample 1:</p> <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;JSONP example&lt;/title&gt; &lt;script src="http://code.jquery.com/jquery-1.10.1.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Test&lt;/h1&gt; &lt;script&gt; $.ajax({ type: 'GET', dataType: "json", processData: false, crossDomain: true, jsonp: false, url: "http://flxn.eu/json.php", success: function (responseData, textStatus, jqXHR) { console.debug(responseData); $.each(responseData, function (index, value) { console.debug(value); $('body').append(value.name + '&lt;br /&gt;' + value.address + '&lt;br /&gt;' + value.city + '&lt;br /&gt;' + value.postcode + '&lt;br /&gt;' + '&lt;br /&gt;'); }); }, error: function (responseData, textStatus, errorThrown) { alert('POST failed.'); } }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>sample 2:</p> <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;JSONP example&lt;/title&gt; &lt;script src="http://code.jquery.com/jquery-1.10.1.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;test jsonP&lt;/h1&gt; &lt;script&gt; $.ajax({ type: 'GET', dataType: "json", processData: false, crossDomain: true, jsonp: true, url: "http://widget.mondialrelay.com//parcelshop-picker/v3_0/services/parcelshop-picker.svc/SearchPR?Brand=BDTEST%20%20&amp;Country=FR&amp;PostCode=62620&amp;ColLivMod=24R&amp;Weight=&amp;NbResults=7&amp;SearchDelay=&amp;SearchFar=75&amp;=Zone_Widget&amp;VacationBefore=&amp;VacationAfter=&amp;Service=&amp;Latitude=&amp;Longitude=&amp;method=jQuery16206304910685867071_1380876031038&amp;_=1380879686732", success: function (responseData, textStatus, jqXHR) { console.debug(responseData); }, error: function (responseData, textStatus, errorThrown) { alert('POST failed.'); } }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    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