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 8036567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:39:45+00:00 2026-06-05T02:39:45+00:00

I am the developer of an application that in addition to its main purpose

  • 0

I am the developer of an application that in addition to its main purpose contains a RESTful web service to allow external applications to interact with it. I also ship a web UI as part of the application for configuration and usage purposes. I would like to use the built in web service for the interation between the web UI and the application using ajax calls. The problem is I can’t have the web service calls be in my jquery code since the user could be accessing the web UI from anywhere and it would not know the correct address of the web service without manually editing the code? Is there a good way to over come this obstacle? It must be a pretty common to have a web UI communicate with an application’s built in web service via javascript.

Here is an example of the web service call I currently am using:

$.getJSON('http://localhost:8732/api/objects/type/place?callback=?', null, function (data) {
      //$('#callback').html(data);
      $("#callback").append('<ul id="places" data-role="listview" data-theme="g">');
      $.each(data,function(i,obj){
         $("#places").append('<li><a href="#" onclick="openPlace(\''+obj.Name+'\');" >'+obj.Name+'</a></li>');
      });
      $('#places').listview();
  });

As you can see I have just put in localhost as the address to the web service, but this will only work when I access the web UI from the same machine as the service. What other way can I go about doing this? Do have t resort to using some kind of server side scripting? That is what I was hoping to avoid by using jquery and a restful web service.

  • 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-05T02:39:46+00:00Added an answer on June 5, 2026 at 2:39 am

    ‘localhost’ is simply an alias for 127.0.0.1, which is your local computer. Your computer also has a real ip address that identifies it on your local network. That likely looks something like 192.168.x.x. You can use that computer’s actual address to talk to the webservice:

    ‘http://192.168.x.x:8732/api/objects/type/place?callback=?…’

    (Of course this only works if you’re connecting to that computer from the same network.)

    If you’re looking to make it available to “other” people you would have to publish your webservice like you publish a website..ie forward a port to that computer from that router..and use your external ip address and/or dns to hit it.

    Update:

    How are you serving the html? If your application is something like a router where the admin interface is web-based, you can save/use the hostname and use in your service calls back home. It would be your customer’s responsibility to connect to the admin webapp..so they could use localhost, 127.0.0.1, 192.168.1.x, //someservername or some other aliased method.. All you should care about is the host?

    var host = window.location.hostname;
    $.getJSON('http://' + host + ':8732/api/objects/type/place?callback=?', ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a Rails application that contains Developer s who have Application s.
I created a new web application in visual web developer. I saw that the
I have a Web Application that I received from another developer, when I first
I am a developer working on an ASP.Net Web Application that uses forms authentication.
I am the primary developer on a Rails application that allows customers to manage
While developer a client side application I ran into an error that I believe
We have developed a .NET web application that uses SQL Server as a backend.
I am a android developer, and I'm developing an application that have multiple user
I am a developer working on an internal web-based application, and I have been
I am working on a Java 1.4 web application that uses Axis 1 web

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.