Note that there are some explanatory texts on larger screens.

plurals
  1. POAJAX post not working, data does not seem to be passing through
    primarykey
    data
    text
    <p>My AJAX post form doesn't seem to be working. It seems as if no data is being passed through. Any idea why?</p> <p><strong>Form</strong></p> <pre><code>&lt;label for="title"&gt;Please give your idea a title&lt;/label&gt; &lt;br /&gt; &lt;input type="text" id="title" name="title" /&gt; &lt;/p&gt; &lt;p&gt; &lt;label for="message"&gt;Please provide details of your idea&lt;/label&gt; &lt;br&gt; &lt;input type="text" id="message" name="message" /&gt; &lt;/p&gt; &lt;input type="button" id="sendmessage" value="Post"&gt;&lt;/input&gt; </code></pre> <p><strong>jQuery</strong></p> <pre><code> $.post("assets/post.php", { title: $("#title").val(), message: $("#message").val() }, function (data) { alert(data); $chat.prepend('&lt;span class="idea"&gt;&lt;strong style="color: #0081C5"&gt;' + $messageTitle.val() + '&lt;/strong&gt;' + '&amp;nbsp;-&amp;nbsp;' + $messageBox.val() + '&amp;nbsp;' + '&lt;a class="delete" href="#"&gt;[Delete]&lt;/a&gt;' + '&lt;/span&gt;') $messageTitle.val(''); $messageBox.val(''); $('#post_confirm').show().html('&lt;br&gt;&lt;span class="confirm_msg"&gt;Message posted successfully&lt;/span&gt;'); $('#chat').height($(window).height() - $('.header').height() - $('.user').height()); setTimeout(function () { $('#post_confirm').fadeOut('slow'); $('#chat').height($chatHeight_user); }, 1000); }); </code></pre> <p><strong>post.php</strong></p> <pre><code>&lt;?php include("config.php"); $title = $_POST["title"]; $message = $_POST["message"]; $sql = "INSERT INTO idea (title,message) VALUES (:title,:message)"; $q = $pdo-&gt;prepare($sql); $q-&gt;execute(array(':title'=&gt;$title,':message'=&gt;$message)); ?&gt; </code></pre> <p>I get the following error message:</p> <p><img src="https://i.stack.imgur.com/vrFVO.png" alt="enter image description here"></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