Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8150431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:03:51+00:00 2026-06-06T15:03:51+00:00

I am using apache tomcat as a web server. I have deployed webservices on

  • 0

I am using apache tomcat as a web server.
I have deployed webservices on tomcat.
If i post request through jquery ajax from local file system to tomcat webservice in response i am getting 403 error.

If i run the same script from the same container i am getting valid response from the webservice.

I am using following code.

function callservice() 
    {
    jQuery.support.cors = true;
        var mobNo = document.getElementById('mobileNo').value;
        var acctNo = document.getElementById('accountNo').value;
        //var id = document.getElementById('id').value;
        var custNo = document.getElementById('customerId').value;

        //var mobNo = document.getElementById('txt_name').value;
        //alert("mobileNo" + mobNo+"accountNo" + acctNo+"customerId "+custNo);

        var url = "http://localhost/mobile-services/rest/user/";        
        var dataVal = {};
        dataVal["mobileNo"] = mobNo;
        dataVal["accountNo"] = acctNo;
        dataVal["customerId"] = custNo;

        var forminput = JSON.stringify(dataVal);

    $.ajax({
        url: url,
        type: "POST",
        data:forminput,
        processdata: true,
        contentType: "application/json;",
        beforeSend: function () { },
        headers : 
        {
            "Content-Type"  : "application/json",
            "Accept" : "application/json"               
        },
        success: function (data) 
        {          
            if (data.authenticated==true)
            {
                window.location.replace("http://localhost:8080/mobile-services/selected_services.jsp?userId="+data.id);
            }
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) 
        {
            try 
            {
                alert(JSON.stringify(XMLHttpRequest) + "\n" + textStatus + "\n" + errorThrown);
            }
            catch (ex) { alert("Exception occured.. "); }
            finally { }
        }
    });
}

Please suggest.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T15:03:52+00:00Added an answer on June 6, 2026 at 3:03 pm

    Because webserver is assuming it cross domain communication thats why you are getting 403.

    You need to use JSONP for this

    https://github.com/jaubourg/jquery-jsonp

    basic usage.

    $.jsonp({
          var url  = "abc.do";
          success: function(jsonData, textStatus) {
              $.jsonp({
                  url: url+"?callback=?",
                  success: function(jsonData, textStatus) {
    
                  },
                  error: function(xOptions, textStatus){
    
                  }
            });
    
          },
          error: function(xOptions, textStatus){
    
          }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web service application that I deployed successfully on Apache Tomcat using
We have a client server hosting our web application using Apache 2.2 & Tomcat
We have an application deployed on tomcat. To access application we are using apache
I am planning on using Apache Tomcat 6.0 as web server in my web
I have made an Axis2 Web Service in Java. I am using Apache Tomcat
I am using Apache Tomcat 7.0 for web-service deployment and eclipse IDE.I have made
I am using Tomcat 6 and have some questions about Apache mod_jk as follows.
i have developed an application using jsf 1.2. it worked fine with apache tomcat
I'm working on a web application for Apache Tomcat. I'm using a class called
I have an existing large(ish) PHP web app (using Apache and MySQL) which now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.