ajax call reports error yet still works

I have this code that runs on an apache server on my local machine (win7). The code calls php and inserts an entry into the database (mysql). If it succeeds or fails it pops up an alert to tell the user. Ok. So, that works fine and you get the success message and you also see the entry on the database. Then i moved the code to a linux xamp server. When I put the entry and thus run the code the GUI returns the failure alert YET!!! if you look at the database everything works fine. That is it did add the entry as expected. I did an alert(text); command to get some clue as to what is going on. On the linux machine it returns “SUCCESS” on the windows machine it returns “SUCCESS” follow by a bunch of other stuff. Again, the back end works it is just that the application thinks there was a problem with the ajax call. Here is the code

webix.ajax().post("insert_new_Sales_Order.php", { SalesOrder:$$("newSoNum").getValue(), DUEDATE:dueDate }, { 
    //response
   error:function(text, xml, XmlHttpRequest){
       alert("could not open 'insert_new_Sales_Order.php' file");
   alert("text-->"+text);  //DEBUG
   },
   success:function(text, xml, XmlHttpRequest){
   alert("text-->"+text);  //DEBUG
       if(text.indexOf("SUCCESS") > -1) {
           webix.alert({ ok:"OK", type:"alert-warning", text:"New SALES OREDER was created SUCCESSFULLY" });
           //get form and window objects
           var win = $$("newSalesOrderWindow").getTopParentView();
           win.hide();  //hide window
           $$("newSoNum").setValue("");  //clear field for next iteration
           
       }

       else if(text.indexOf("PARAMETER_ERROR") > -1){
           webix.alert({ ok:"OK", type:"alert-warning", text:"Sales Order number or due-date where not passed correctly" });
       }
       
       else if(text.indexOf("INSERT_FAIL") > -1){
           webix.alert({ ok:"OK", type:"alert-warning", text:"FAILED while inserting new S/O" });
       }

       else{
           webix.alert({ ok:"OK", type:"alert-warning", text:text });
       }
   }
});

Error handler will be triggered based on status code of response.

If server side returns status code 40x or 50x - it will be processed as error response.

NEVER MIND!!! It turns out that I needed a return statement on the php side. Apparently the webix side was being confused by what it was being returned. I wonder why this is not an issue on windows.