It seem to be a CROS issue, thanks for your advice. Although, after i reconfigured my tomcat service.xml, i still get the some message as above.
any advices of how to change my JQuery request? Thanks. On Wed, Apr 25, 2018 at 2:06 PM, Mario Schmitz <m.schm...@ktbl.de> wrote: > Hey, > > seems u have a problem with CORS > > https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS > > cheers > > -----Ursprüngliche Nachricht----- > Von: Zahi Fail [mailto:zahi.f...@gmail.com] > Gesendet: Mittwoch, 25. April 2018 12:53 > An: Tomcat Users List <users@tomcat.apache.org> > Betreff: [eX-Bulk]: Error while sending ajax post request to my tomcat web > app > > Hello, > > I'm working with Tomcat 9.0.6 version as my servlet, I have tested my web > service with postman and it seems to work fine. > > While i tried to send simple ajax that i have build and tested in chrome, > i got an error. > > *the request is :* > > function setAllTlcsStatus() { > var tlc = [{"id":1, "code":2, "time":"2009-02-15", "cycleSecond":22, > "programNumber":1221, "stageNumber":22, "moves":"22", "detectors":"fead"," > conditions":"2ddsa"}; > data.push(tlc); > $.ajax({ > type: 'POST', > url: "http://127.0.0.1:8080/userManagement/rest/Traffic/users2", > dataType: 'json', > contentType: 'application/json', > data: JSON.stringify(tlc), > success: function( data, textStatus, jQxhr ){ > alert("good"); > }, > error: function( jqXhr, textStatus, errorThrown ){ > alert("Not good"); > console.log( errorThrown ); > } > }); > } > > > *and the error i got: * > > *Failed to load http://127.0.0.1:8080/userManagement/rest/Traffic/users2 > <http://127.0.0.1:8080/userManagement/rest/Traffic/users2>: Response to > preflight request doesn't pass access control check: No > 'Access-Control-Allow-Origin' header is present on the requested resource. > Origin 'null' is therefore not allowed access.* >