-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Zahi,
On 4/25/18 8:38 AM, Zahi Fail wrote: > 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? What CORS headers are being returned by the initial request to the page which includes this javascript? I hate to ask this, but if you don't understand CORS, why are you using it? - -chris >> 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.* >> > -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlrg8JUACgkQHPApP6U8 pFgC9hAAgTaqFykR4hxAaOyb3IyKZQ/I2Ko0XiPgQmP6/JYQt5wyVkv/PW/W3U3G iCffikgWjxr6NmFLN5tpEuJfnqYZXNrDC+GAY4NCB+UGEUuPZ+QgchmvBLMNdqhJ vsQFi+5h9glD+zN6R2hd2d/phedgJ/F54krchsxuXvYvIJiHuHe6go/OMWNL2LIX hPToNzLi5zpdzzDZ1GrkVhQjhVFIJO0BN473fAiVX3HHuXxfgWhTMBqYzMu/ScPU RTdoB9VbVvDL3hHmhTV2rzkYXGTKzdEb86Y83elizkt4/1d9DgNpRXOTn8IMcQWa pYwHWPYzFHsk7FOmS2vNKqrsNpwIyBoFGEuuP8T6u/d5+HUYJTV3B4fCmjtxdu5l Ci3D2ug/ngdfOJWjIPtFNC2soMH8GR1CJ8NcV2VStIpQ5BkZ8PbFM/qafpcywnfX RvLZlhIeudpN1560SpMc5yucJ1H5rq+Ko2qy0aaMexkYOGzamT8mkH6kyIiT8a3Y CKGKN/Jf3+lRAyZ6oQLcB1QzuReOzcMmdpzVZkMBy0tn+G2U6EVg+StscPxL28YN 7NbszPXKwOs9lD8sQX61nc5p1F0hBBeg3i+0OlexdNXT1cZ2DAm4yOXVhfI3OEb9 R2+uYQcsdrpjisfYMJ+zCqNjWxuP9V5eag9pKDQNdxWMCHnQ5wM= =i9J6 -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org