Note that there are some explanatory texts on larger screens.

plurals
  1. POAjax (jQuery) cross domain output -
    primarykey
    data
    text
    <p>As is such function doesn't support cross domain request</p> <pre><code> function makeRequest(url) { var http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { alert('Cannot create an XMLHTTP instance'); return false; } http_request.onreadystatechange = function() { alertContents(http_request); }; http_request.open('GET', url, true); http_request.send(null); } function alertContents(http_request) { if (http_request.readyState == 4) { if (http_request.status == 200) { receiveData(http_request.responseText); } else { alert("error"); } } } </code></pre> <p>so decided to use jQuery (with <a href="http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/" rel="nofollow">this plugin</a>) but function</p> <pre><code> $.ajax({ url: suchurl, type: "GET", //dataType: "text", dataType: "text", //global: false, //async:false, cache: false, success: function(data) { //alert(data); alert(data.responseText); } }); </code></pre> <p>output like</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;meta content="HTML Tidy for Java (vers. 26 Sep 2004), see www.w3.org" name="generator"/&gt; &lt;title/&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;new_towns = [ {id:"0", name:" "}, {id:"205", name:"City205"}, {id:"17", name:"City17"} ];&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Why?.. when expecting just</p> <pre><code>new_towns = [ {id:"0", name:" "}, {id:"205", name:"City205"}, {id:"17", name:"City17"} ]; </code></pre> <p><strong>What you advice? Thanking you in advance.</strong></p> <hr> <p>such example code - doesn't work</p> <pre><code> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;&lt;/title&gt; &lt;script src="http://www.google.com/jsapi"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; google.load("jquery", "1.6.2"); google.setOnLoadCallback(function() { $.ajax({ url: suchurl, type: "GET", dataType: "text", crossDomain:true, async:true, cache: false, success: function(data) { alert("all right"); } }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <hr> <p><strong>OK, guys, it's more simple and more fast&amp;understandable decision use script get.php</strong></p> <pre><code>&lt;?php if(isset($_POST['geturl']) and !empty($_POST['geturl'])) { $data = file_get_contents($_POST['geturl']); print $data; } ?&gt; </code></pre> <p><strong>and then just</strong></p> <pre><code>$.ajax({ url: 'get.php', data: {geturl: suchurl}, type: 'POST', dataType: "text", cache: false, success: function(data){ alert(data); //do something else } }); </code></pre> <p><strong>TNX VERY MUCH FOR YOUR ATTEMPTS TO HELP AND TIPS!</strong></p>
    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