I have updated this question as per Cimbali's suggestion. This is now the js code that specifies the request:
......
function editFiltName($thisFiltCell) {
var cellText=$thisFiltCell.text();
var idx=$thisFiltCell.index(); //alert("idx: idx");
var newFN=prompt("Enter new filter name below - up to 12 characters.", cellText);
switch (newFN) {
case null : return; // cancel key hit
case cellText : return; // no change
case "" : ; //$thisFCell.text('Filter' + (idx+1));
default : $thisFiltCell.text(newFN);
}
var action='updateFiltName';
var request = MrAjax(action,newFN,idx);
} // end main function
//*******************************************
function MrAjax(action,P1,P2) {
console.log("Ajax-> action: "+action+" P1: "+P1+" P2: "+P2);
var jqxhr=$.ajax({
type: "POST",
url: "../phpMain/editTblField.php",
data: {action:action, P1:P1, P2:P2}
});
jqxhr.always(function() { console.log("jqxhr.status: " + jqxhr.status ); });
} // end MrAjax
This is now the console output when I enter some data:
Any suggestions? Note that console error is followed immediately by a 'success' response for the same file. But the php file still does not run. I get no php error response from the server - nor do I see my embedded echo I placed on the 1st line of the php file echo("Got here!);
. That's true even when I comment out everything but that line.
I don't think it's in the php code but just in case, here it is:
<?php
echo "Got here!";
?>
Thanks again for taking a look.
Your error comes from a typo in your console log, you mixed up concatenations from different languages.
Instead of
console.log("jqxhr.status: " . jqxhr.status );
you wantconsole.log("jqxhr.status: " + jqxhr.status );
A second error seems to be that the
status
field doesn't exist (from your comment). However, from the jquery doc, http://api.jquery.com/jQuery.ajax/#jqXHR :I also ready it is a Deferred object, so maybe this strange behaviour comes from trying to access the status field before it exists. Try waiting for the completion of the request.
So instead of
console.log("jqxhr.status: " + jqxhr.status );
, use the following :or