Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you want the data to grow your element, let's try something like that :</p> <pre><code>function fillWithClicked(loResponseParsed){ document.getElementById("regulations").innerHTML += loResponseParsed; } </code></pre> <p>If the calls of your function are not in the same page, you'll need to use a cache file and a user_id (session id, cookie id or IP adress...):</p> <pre><code>// js &amp; jquery for example function fillWithClicked(loResponseParsed,user_id) { $.post('cachecreate.php',{content:loResponseParsed,user_id:user_id}, function() { $.get('cachefile_'+user_id+'.html', function(data) { document.getElementById("regulations").innerHTML=data; }); }); } // cachecreate.php for example &lt;?php $cache = "cachefile_".$_POST['user_id'].".html"; ob_start(); if(file_exists($cache)) { include($cache);//or readfile(); i forgot... echo "&lt;hr/&gt;".$_POST['content'];// Strip &lt;hr/&gt; for JSON } else { echo $_POST['content']; } $page_content=ob_get_contents();// if JSON needed : json_encode($page_content); ob_end_clean(); file_put_contents($cache, $page_content);// PHP 5+ function ?&gt; </code></pre> <p>I hope that it may help you, or bring you to the solution.</p> <p><strong>EDIT regarding your new details</strong></p> <p>Try something like this (I lighten your code...). With this you can add as multiple urls as you want.</p> <pre><code>var clickLoc; function queryAct(event) { clickLoc=event.latLng; var clickLat=clickLoc.lat(); var clickLng=clickLoc.lng(); var url=Array(); var data=null; url['loUrl'] ="url1"; url['distUrl'] ="url2"; url['otherUrl'] ="urlx"; for(page in url) { data+=getJSON(page); } fillWithClicked(data); } function getJSON(url) { if (window.XMLHttpRequest) {req = new XMLHttpRequest();}// Non-IE else if (window.ActiveXObject) {req = new ActiveXObject("Microsoft.XMLHTTP");}// IE if(req) { req.open("GET", url, true); req.send(null); req.onreadystatechange = function() { if(req.readyState == 4) { if (req.status == 200) { // OK response var clickPingBack = JSON.parse(req.responseText); var loResponse = clickPingBack; if (loResponse.rows.length&gt;0) { var loResponseParsed=loResponse.rows[0].ownercateg; } else { var loResponseParsed=' other'; } return loResponseParsed; } } } } } var infowindow = new google.maps.InfoWindow; function fillWithClicked(loResponseParsed) { infowindow.setContent(loResponseParsed); infowindow.setPosition(clickLoc); infowindow.open(map); } </code></pre> <p><strong>EDIT -> External domain files</strong></p> <p>httpRequest doesn't work with files in another domain. You can use one of those solutions, I may use the second for me.</p> <p>PHP Solution</p> <pre><code>// In your js file, change the urls like this url['url_x'] ='myphppage.php?url=url_x_to_parse'; // myphpage.php script that displays the content of the external file &lt;?php if(isset($_GET['url'])) { header("Content-type: text/json"); echo file_get_contents(urldecode($_GET['url'])); } ?&gt; </code></pre> <p>JQUERY solution (better one)</p> <p>// change the name of getJSON function cause jquery uses the same name...</p> <pre><code> function getURLcontent(url) { $.get(url,function(data){ var clickPingBack = JSON.parse(data.responseText); var loResponse = clickPingBack; loResponse=data; if (loResponse.rows.length&gt;0) { var loResponseParsed=loResponse.rows[0].ownercateg; } else { var loResponseParsed=' other'; } return loResponseParsed; }); } </code></pre> <ul> <li>download jquery library <a href="http://code.jquery.com/jquery-1.7.1.min.js" rel="nofollow">http://code.jquery.com/jquery-1.7.1.min.js</a></li> <li>include jquery plugin in the head of your page with <code>&lt;script src="jquery-1.7.1.min.js"&gt;&lt;/script&gt;</code></li> </ul>
    singulars
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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