Note that there are some explanatory texts on larger screens.

plurals
  1. PO2 buttons are not performing any sort of functionality
    primarykey
    data
    text
    <p>I have 2 buttons which I want to do the following but it is not doing anything at the moment:</p> <p>Enable Button:</p> <ul> <li>Button onclick will access the <code>enableHandler()</code> function, if user confirms the confirmation, then navigate the user to the <code>penaltymarks.php</code> page.</li> </ul> <p>Disable Button:</p> <ul> <li>Button onclick will access the <code>disableHandler()</code> function, if user confirms the confirmation, then navigate the user to the <code>completes.php</code> page and the ajax will navigate to the <code>completesession.php</code> page in the background.</li> </ul> <p>How can I get my buttons to perform the above because nothing is happening with the code I have at the moment. Do I need <code>&lt;form&gt;</code> tags by the way as I have not included form tags in my code.</p> <pre><code>&lt;script type="text/javascript"&gt; $(function() { enableHandler() { if (confirm("Are you sure you wish to enable Penalty Marks?" + "\n" + "(You cannot change your option once you have confirmed)" + "\n")) { $.ajax({ url: "penaltymarks.php", async: false, type: "POST" }); return true; } }; }); $(function() { disableHandler() { if (confirm("Are you sure you wish to disable Penalty Marks?" + "\n" + "(You cannot change your option once you have confirmed)" + "\n")) { $.ajax({ url: "sessioncomplete.php", async: false, type: "POST" }); return true; } }; }); &lt;/script&gt; </code></pre> <p><strong>UPDATE:</strong></p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="button" id="enablePenalty" value="Enable Penalty Marks"/&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="button" id="disablePenalty" value="Do Not Enable Penalty Marks"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;script type="text/javascript"&gt; $('#enablePenalty').click(function () { if (confirm("Are you sure you wish to enable Penalty Marks?" + "\n" + "(You cannot change your option once you have confirmed)" + "\n")) { window.location = "penaltymarks.php", return true; } }); $('#disablePenalty').click(function () { if (confirm("Are you sure you wish to disable Penalty Marks?" + "\n" + "(You cannot change your option once you have confirmed)" + "\n")) { $.ajax({ url: "sessioncomplete.php", async: false, type: "POST" }); window.location = "complete.php", return true; } }); &lt;/script&gt; </code></pre>
    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.
 

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