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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:53:05+00:00 2026-05-24T12:53:05+00:00

Here is my situation: Im creating a widget that site admins can embed in

  • 0

Here is my situation:
Im creating a widget that site admins can embed in their site and the data are stored in my server. So the script basically has to make an ajax request to a php file in my server to update the database. Right? Right 🙂
The ajax request works excellent when i run it in my local server but it does not work when the php file is on my ONLINE server.
This is the code im using:

var url = "http://www.mydomain.net/ajax_php.php";
var params = "com=ins&id=1&mail=mymail@site.net";
http.async = true;
http.open("POST", url, true);       

http.onreadystatechange = function() {

    if(http.readyState == 4 && http.status == 200) {

    //do my things here
    alert( http.responseText ); 

    }
}
http.send(params);

In firebug it shows: http://www.mydomain.net/ajax_php.php 200 OK X 600ms.

When i check the ajax responnseText I always get a Status:0

Now my question is: “Can i do cross-domain ajax requests by default? Might this be a cross-domain ajax problem? Since it works when the requested file resides in my local server but DOESN’T work when the requested file is in another server, im thinking ajax requests to another remote server might be denied? Can you help me clear on this?
Thanks..

  • 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-05-24T12:53:08+00:00Added an answer on May 24, 2026 at 12:53 pm

    Cross-domain requests are not directly allowed. However, there is a commonly-used technique called JSONP that will allow you to avoid this restriction through the use of script tags. Basically, you create a callback function with a known name:

    function receiveData(data) {
        // ...
    }
    

    And then your server wraps JSON data in a function call, like this:

    receiveData({"the": "data"});
    

    And you “call” the cross-domain server by adding a script tag to your page. jQuery elegantly wraps all of this up in its ajax function.

    Another technique that I’ve had to use at times is cross-document communication through iframes. You can have one window talk to another, even cross-domain, in a restricted manner through postMessage. Note that only recent browsers have this functionality, so that option is not viable in all cases without resorting to hackery.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the situation is like this: im creating a Logger class that can write to
Here is the situation: I have a huge data set that I need quick
The situation : I am creating a server daemon in c that accepts numerous
Here's the lowdown of the situation. I am creating a role-playing game with PHP.
Here's the situation - I've got a shell that loads an external .swf. Now,
Here is my situation. I'm creating a drawing application using OpenGL and WinAPI. My
So, here's the situation: I have a parent buildfile that defines a compilation task,
Here's the situation: subversion is already installed in the server and I have access
Here is my situation: I have an application that use a configuration file. The
Here's my situation. Say I have two columns of data containing different elements. I'd

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.