ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Ajax call to another server?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ajax call to another server?

    I have an ASP page served from an IIS server. If the validation of a customer number is required on this page (for example) and I already have a AS400 CGI validation routine for that, is there a way of using AJAX to access the 400 to call this routine?

    Searching through the net, I find suggestions that this should be impossible; due to security constraints apparently the XMLHttpRequest object can only access pages that are served from the same host that served the first page.

    However my test actually worked fine, although I got the pop-up from IE asking since this was a call to another server did I wish to allow it? Clicking ?yes? meant the CGI program was called and I got back my response fine. I then tried to add my 400 into the sites to be trusted within IE (to avoid getting the pop-up), but then got no pop-up but the ajax call failed with ?access refused? in the javascript.

    So maybe it is impossible? Or are there Apache directives that come into play? Any ideas anyone?

    Thanks

  • #2
    Re: Ajax call to another server?

    I don't know the answer to your question. But one possible solution to your problem is to wrap a web service around your validation routine. You could then create an ASP object that consumed that web service, and call that from your AJAX. That way, the AJAX would be calling something on your ASP server.

    Just a thought.
    "Time passes, but sometimes it beats the <crap> out of you as it goes."

    Comment


    • #3
      Re: Ajax call to another server?

      Thanks for the answer

      > You could then create an ASP object that consumed that web service

      Is the above something that you have already done? Any pointers or links to get me started when I have a spare 5 mins?!

      Andrew

      Comment


      • #4
        Re: Ajax call to another server?

        Originally posted by Andrew K View Post
        Thanks for the answer

        Any pointers or links to get me started when I have a spare 5 mins?!

        Andrew
        Sure. I'll write 'em down for you...when I have a spare 5 minutes.
        "Time passes, but sometimes it beats the <crap> out of you as it goes."

        Comment

        Working...
        X