Sol Sol - 7 months ago 21
HTML Question

How can you get form post data with JQuery from the Post?

I have a hidden field where the question_id is unique. I am trying to get that hidden field within jquery from the next page so that I can post a message of the form status.

Then I will put that status in the HTML at the bottom of the form that was submitted.


<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>jQuery File Upload</title>
<script src="//"></script>

function submitForm(upload_input_field){
return true;
$(function () {
<form action="uploadFile.php" target="uploadIframe" method="post" enctype="multipart/form-data">
<input type='button' class='btn btn-default' onClick='submitForm(this)' value='Submit' />
<input name='question_id' value='123' type='hidden' />
<iframe style="border:0;" id="uploadIframe" name="uploadIframe"></iframe>
<div id="successMessage123"></div>


<?php $question_id = $_POST['question_id']; ?>
$("[name=question_id]").val(var questionid);
//$(('#successMessage_'+question_id), window.parent.document).html('<p>hidden value success</p>');
$('#successMessage_'+question_id).html('<p>hidden value success</p>');


Your JavaScript, which is client-side, (JQuery is a JS library) can only parse content rendered/output by the server(PHP). One easy solution would be inline PHP like this:

<?php   $question_id = $_POST['question_id']; ?>
        $('#successMessage_'+question_id).html('<p>hidden value success</p>');