inconsistent checking response.responseText?
I'm using jQuery and jqGrid in an application. I have a function
function messageControl(response, formdata, id){
switch(response.responseText){
case '0': ....
case '1': ....
case '2': ....
default: ....
}
}
The respo开发者_JAVA技巧nse is a PHP statement like echo 0;
from the jqGrid editUrl. I have this function implemented on a series of scripts that are very similar except for the database table they access. Why would this work on some, and on others always skip the case options to the default? I can see in Firebug that the response is the correct digit.
Make sure you're using break statements. If you are already, walk through it in a debugger to see what's happening.
EDIT: Well, that's the issue. "\n1" is not strictly equal (=== operator) to '1' (switch-case uses strict equality). In fact, it's not loosely equal (==) either. Most likely, you have output somewhere in an include. Search for headers already sent. Even though you're not getting that error, it's the same cause.
精彩评论