Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Like Rene points out, this is most likely a javascript syntax error, that is preventing the onSubmit function to kick in before the actual submit.</p> <p>Suggest trying your code in jsfiddle.</p> <p>I see PHP code in the xmlhttp.open request. How are you inserting that code? this might be a fail point if you are just trying to use that code in a js file and expecting the client to execute that (it will just spit out a syntax error, because a javascript file will never and should never interpret server side code).</p> <p>Also , have you considered using jQuery or another js library that would help you in writing cleaner ajax requests? </p> <p><strong>Edit With Answer (according comment below):</strong></p> <p>Not sure what your PHP is for the rest of the file, but here is what I have used and tested locally to make sure it works. Corrected some syntax errors, also on the PHP side, the way you output variables. Paste this code in your index.php file or whatever you are using:</p> <pre><code>&lt;div id='premijera' class='neispravniPodaci'&gt;Report wrong data &lt;div id='neispravnaForma' class='arrow_box'&gt; &lt;form name='frm1' action='javascript:neispravniPod();' method='get'&gt; &lt;input class='textbox' type='text' name='forma' placeholder='input for wrong data'&gt; &lt;input type='submit' name='sendForm' value='Send' class='button'&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;script type="text/javascript"&gt; function neispravniPod() { var xmlhttp; var forma = document.forms.frm1.forma.value; if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); } xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200) { document.getElementById('neispravnaForma').innerHTML = '&lt;t style=\"font-size:15px;font-weight:bold;color:black;\"&gt;Hvala!&lt;/t&gt;'; } }; xmlhttp.open('GET', 'glasanje.php?id=&lt;?php echo $idfilm ?&gt;&amp;neispravno='+forma+'&amp;ip=&lt;?php echo $_SERVER["REMOTE_ADDR"] ?&gt;&amp;korisnik=&lt;?php echo $userdata['user_id'] ?&gt;', true); xmlhttp.send(); } &lt;/script&gt; </code></pre>
 

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