Note that there are some explanatory texts on larger screens.

plurals
  1. POshowing result of file call by ajax request into different div
    primarykey
    data
    text
    <p>On button click I submit the form and post some data to <code>data.php</code>.</p> <p></p> <p>The result Of <code>data.php</code> I show in some <code>div</code> on index.php</p> <p>index.php:</p> <pre><code>function showUser(form, e) { //alert(myid); e.preventDefault(); e.returnValue=false; var xmlhttp; var sent = form.elements['sent'].value; var text1 = document.getElementById('previewUrl').innerText || document.getElementById('previewUrl').textContent; var text2 = document.getElementById('previewTitle').innerText || document.getElementById('previewTitle').textContent; var text3 = document.getElementById('previewDescription').innerText || document.getElementById('previewDescription').textContent; //alert(text3); console.log(sent); if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function(e) { if (xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200){ xmlhttp.responseText.resultOne; xmlhttp.responseText.resultTwo; document.getElementById("myFirstDiv").innerHTML=xmlhttp.responseText.resultOne; document.getElementById("mySecondDiv").innerHTML=xmlhttp.responseText.resultTwo; } } xmlhttp.open(form.method, form.action, true); xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); deURIComponent(text3); xmlhttp.send('sent=' + sent + '&amp;text1=' + text1 + '&amp;text2=' + text2 + '&amp;text3=' + text3); } </code></pre> <p>Data.php looks like this:</p> <pre><code>&lt;?php //sent has value "http://www.paulgraham.com/herd.html" $url=$_POST['sent']; $text1=$_POST['text1']; $text2=$_POST['text2']; $text3=$_POST['text3']; //Some processing echo $restult1; // I want to show this on &lt;div1&gt; on main page index.php //Some processsing echo $result2; // I want to show this on &lt;div2&gt; on main page index.php ?&gt; </code></pre> <p><strong>HOW can I show result1 and result2 on different div on index.php?</strong></p>
    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.
 

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