Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Made some modifications, nothing is wrong, hope this helps.</p> <p><img src="https://i.stack.imgur.com/jmrZZ.gif" alt="enter image description here"></p> <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;script&gt; Element.prototype.postAjax = function (params, url) { var ajaxRequest; try { // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e) { // Internet Explorer Browsers try { ajaxRequest = new ActiveXObject ("Msxml2.XMLHTTP"); } catch (e) { try { ajaxRequest = new ActiveXObject ("Microsoft.XMLHTTP"); } catch (e) { // Something went wrong alert("Your browser broke!"); return false; } } } ajaxRequest.open ("POST", url, true); ajaxRequest.setRequestHeader ("Content-type", "application/x-www-form-urlencoded"); ajaxRequest.setRequestHeader ("Content-length", params.length); ajaxRequest.setRequestHeader ("Connection", "close"); ajaxRequest.send (params); var _this = this; ajaxRequest.onreadystatechange = function () { if (ajaxRequest.readyState === 4) { if (ajaxRequest.status === 200) { _this.innerHTML = ajaxRequest.responseText; } else { alert ("Error, please try again."); } } } } window.addEventListener ("load", function () { var button = document.getElementsByTagName ("input")[0]; var id = 1; // Don't know where you get it var wishlist = document.getElementById ("wishlist"); button.addEventListener ("click", function () { wishlist.postAjax ("mode=wishlist&amp;id=" + id, "ajax.php"); }, false); }, false); &lt;/script&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;input type = "button" value = "Click me man !" /&gt; &lt;div id = "wishlist"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Multiple clicks:</p> <pre><code>document.body.addEventListener ("click", function (event) { var target = event.target; if (target.nodeName === "INPUT") { if (target.getAttribute ("type") === "button") { // Every single button inside your document } } }, false); </code></pre> <p>It's the most I can do now, the rest is up to you.</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.
    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