Hallo, i am new to jquery, AJAX requests. Here is my html code in edit_page.php
<td>Action: </td>
<td class="notselected">
<div id="action_response"></div>
<select name="action_db1" id=<?php echo $sel_page['Concession']; ?> onchange="updateaction(this);" >
<option value=""></option>
<option value="move">Move</option>
<option value="copy">Copy</option>
<option value="exclude">Exclude</option>
</select>
</td>
and the javascript code is
function updateaction(item) {
$.post("edit_page_advanced_actions.php", {concession:item.id, action:item.value, db_name:item.name},function(action_response) {
$('#action_response').html(action_response);
});
}
Here i am calling php script *edit_page_advanced_actions.php* in which i wrote some php code. I want to return messages from here based on the database updation to edit_page.php. i.e from the calling script.
EDIT:-
I am updating database in edit_page_advanced_actions.php. I want to return an error message or success message to edit_page.php. i.e from where this is triggered. For example “successfully updated”, “Copied successfully”,”Failed to exclude” to the users based on db operations.
How this can be accomplished.
Thanks in advance!
You should return the error status in the http header using the php
headerfunction. For example:You can then use
$.ajaxwith a special error function: