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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:14:56+00:00 2026-05-28T02:14:56+00:00

So I know this is a common problem and have seen a lot of

  • 0

So I know this is a common problem and have seen a lot of people talking about it but feel that my situation is unique and maybe not as involved as others.

I have a host website and trying to build an iPhone app with JQ and PhoneGap.

I want people to be able to pass their score to my home domain from the app but am getting the dreaded:
“Origin null is not allowed by Access-Control-Allow-Origin.”
when I try and call this:

$.ajax({
        type: "POST",
        url: 'http://www.homesite.com/thephppage.php',
        data: {
            'guid': '12333-54',
            'score': 52,
            'initials': 'tod'
        },
        success: function (data) {
            try {

                }
                else {

                }
            }
            catch (err) {
                alert(err);
            }
        },
        error: function (xhr) {
            alert(xhr.responseText);
        }
    });

Since this is calling out to a domain I own, is there something simple I can do to rectify this issue?

Thanks.
T

  • 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-28T02:14:56+00:00Added an answer on May 28, 2026 at 2:14 am

    WORKING!!! OH GLORY!!! (sort of): Here’s what I did…

    Instead of use the .ajax, I went the JSONP route (sort of) and added a tag to my head dynamically like so:

    var head = document.getElementsByTagName('head')[0];
      script = document.createElement('script');
      script.type = 'text/javascript';
      script.src = 'http://thesite.co/thepage.php?var1=123&var2=432&var3='ttt';
      head.appendChild(script);
    

    I didnt even have to give it a CALLBACK method because (since I own the target site and know its coming) on my PHP side, I wrap the return with a methodName like this:

    $encoded = json_encode($json);
    echo “testMethod(” . $encoded . “)”;
    This worked marvelously EXCEPT IN MY DARN iPhone and iPad simulators!!! (gosh I need to buy the real devices…) So I STILL dont know if this works on the actual devices but it works now in Chrome AND Safari… lets hope I can figure out how to make it work on that phone!

    THANKS to everyone for their help!

    ==========SECOND BETTER MOBILE SOLUTION====================== This works better than the JSONP – dynamic Script solution…

    In your head under your Phonegap and JQ calls insert this tag.

    <script type="text/javascript">
            $(document).bind("mobileinit", function () {
               $.mobile.allowCrossDomainPages = true;
            });
        </script>
    

    Then in your Phonegap.plist file in your XCODE Resources folder, add the domain to External Domains… ie. phonegap.com. (Leave off http or www).

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

Sidebar

Related Questions

I know that this is very common problem and I have gone through almost
I know that snapshot isolation would fix this problem, but I'm wondering if NOLOCK
I know this is a common problem with IE6 from my Google search but
I know this is a common problem but I can't seem to find a
I know this is the most common problem in the history of programming but
I know this must be a pretty common problem, but I haven't been able
I do not know how common this problem is for other users, but for
After some Googling it appears this is a common problem but I have yet
I know this is a common convention, but what does the k in variable
I know this is a common error, but bear with me. I've pursued the

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.