0

I have a front end application running on tomcat 8080 port,i am making a Ajax call using jquery to the backen application which is python application running on localhost:4277/xyz/aplication.python application is not running on tomcat

Ajax call always gives NetwrokEror-bad request 404

Ajax call code is here

              $.ajax(
                {
                    type:'get'
                    cache: true,
                    url: 'http://localhost:4277/v1/virtuals/aa54fa50-e4ca-4a16-9f2b-db6491062cf7',
                  contentType: 'application/json; charset=utf-8',

                    dataType: 'json',

                    success: function (data) {

                        alert('success');


                    },
                    error: function (msg, url, line) {
                        alert('error trapped in error: function(msg, url, line1)');
                        alert('msg = ' + msg + ', url = ' + url + ', line = ' + line);
                        console.log(msg);
                    }
                });
javalearner
  • 347
  • 2
  • 7
  • 21
  • Check this page on the browser: http://localhost:4277/v1/virtuals/aa54fa50-e4ca-4a16-9f2b-db6491062cf7 ..does it return anything? Because if it doesnt, there is no reason to expect that it should from ajax response. 404 means the page cannot be found. whether it is a typo in the url,..or whatever, the page cannot be found. – Afroman Makgalemela Feb 03 '14 at 11:44

2 Answers2

0

Not sure but just giving you suggestion. This issue generally comes when the requested url path is wrong. You hit your url directly in browser and then test what is coming. It can give you some idea. You check this link also : Tomcat 404 error

Community
  • 1
  • 1
Manish Kumar
  • 571
  • 3
  • 15
0

What you are getting is a HTTP 404 error, which says that the file does not exist. You need to check the path, if it is correct.

Or, the other situation might be like this. Cross-Domain requests might be blocked by the browser for security reasons. Try doing a proxy method to avid CORS. Some insights on CORS are here:

  1. Cross-origin resource sharing - Wikipedia
  2. Enable cross-origin resource sharing
  3. Cross-Origin Resource Sharing - W3C Recommendation
Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252