.ajax reports success status but runs the error method

.ajax reports success status but runs the error method

Maybe I am doing something wrong, but this looks like a bug to me.

I run the .ajax method show below:

50           $.ajax(
 51             {
 52               url:"ajax_setEmail_16.Chg",
 53               type: 'POST',
 54               dataType: 'json',
 55               data: JSON.stringify(jem),
 56               contentType: 'application/json',
 57               mimeType: 'application/json',
 58               success: gotEmailAddr16,
 59               error: function(xhr, status, error){
 60                 var errorMessage = xhr.status + ': ' + xhr.statusText
 61                 console.log("ajax_setEmail_16.Chg: 1600 error");
 62                 console.log('page2: ajax_setEmail_16.Chg: Error - ' + errorMessage);
 63                 alert('page2: ajax_setEmail_16.Chg: Error - ' + errorMessage);
 64               }
 65             }
 66           );

It completes successfully and runs the success method.

I run the identical code again:

68           $.ajax(
 69             {
 70               url:"ajax_setEmail_16.Chg",
 71               type: 'POST',
 72               dataType: 'json',
 73               data: JSON.stringify(jem),
 74               contentType: 'application/json',
 75               mimeType: 'application/json',
 76               success: gotEmailAddr16,
 77               error: function(xhr, status, error){
 78                 var errorMessage = xhr.status + ': ' + xhr.statusText
 79                 console.log("ajax_setEmail_16.Chg: 1600 error");
 80                 console.log('page2: ajax_setEmail_16.Chg: Error - ' + errorMessage);
 81                 alert('page2: ajax_setEmail_16.Chg: Error - ' + errorMessage);
 82               }
 83             }
 84           );

Again, it completes successfully and runs the success method.

Then change my source code so that at line 70, the url is changed from:

    url:"ajax_setEmail_16.Chg",

to:

    url:"ajax_setEmail_66.Chg",


The source code in my java servlet that handles these two URLs is identical except for the following 2 debugging lines:

diff /tmp/16 /tmp/66
1,2c1,2
<       else if (function.equals("ajax_setEmail_16.Chg")) {
<               d_debug.DEBUG("BCC 109 Handling ajax_setEmail_16.Chg values.");
---
>       else if (function.equals("ajax_setEmail_66.Chg")) {
>               d_debug.DEBUG("BCC 109 Handling ajax_setEmail_66.Chg values.");

But when the URL "ajax_setEmail_66.Chg" is used the status returned is "200: OK", but instead of calling the success method, it calls the error method.

Like I said, this looks like a bug. Could I be doing something wrong?

Jim A.