Issue
I have a script that’s been running fine since forever. It never gave any issues. It was last used in December with no issues whatsoever. No one changed anything. But now, it doesn’t work. What it’s supposed to do is submit a review and then notify users about the review. But it’s not entering that section were it saves and notifies.
What I Have Done And Results
I have taken out that specific piece of the script that saves and notifies users, and tested it. It doesn’t return anything which means it doesn’t enter it. I’ve checked the post data, and that displays correct. I have also forced correct data to be posted (by changing params = $('#reviewForm').serialize(); to params = 'counter=1'.
My Code
Here is the form that is filled in by the user:
<form id="reviewForm">
Employee that will be reviewed: <input type="text" id="reviewed" name="reviewed" class="items"/><br>
<div id="openReviews" class="ui-corner-all ui-state-error" style="padding: 5 5 5 5"></div>
Employees that will do the review:<br>
<div id="reviewee_1">
<ul><b>Employee 1:</b>
<li>Name: <input type="text" id="reviewer_1" name="reviewer_1" class="items"/></li>
<li>Position: <select id="position_1" name="position_1" class="items">
<option value="sup">Supervisor</option>
<option value="supp">Peers: Support</option>
<option value="tech">Peers: Technical</option>
<option value="sub">Sub-Ordinate</option>
</select></li>
</ul>
</div>
<input type="hidden" id="counter" name="counter" value="1" class="items"/>
Add Another Reviewer <input type="button" id="add" value="Go >>"/><br>
<input type="button" onClick="sendInfo()" value="Create Review"/>
</form>
When Create Review is clicked, it calls this piece of jQuery code:
function sendInfo()
{
if($('#reviewed').val() != "")
{
var params = $("#reviewForm").serialize();
$.post('reviews.php',
params, // as stated, even if I change this to counter = 1, it doesn't work
function(data) {
$('#reviewForm').hide();
$('<p>' + data + '</p>').insertBefore('#reviewForm');
});
}
else
{
alert("Please complete all fields in this form!");
}
}
And then lastly, the code that processes the request:
if($_POST['counter'] > 0) // check if review was submitted
{
// do stuff...
// it doesn't even enter this...
}
Question
Did something change in the PHP or jQuery specs that could cause this to stop working?
Is there something that I’m missing?
What’s going on!?
Please help!
All depends on what JQuery version you use.
I would replace:
to
and for post i would use