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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:53:36+00:00 2026-06-17T10:53:36+00:00

What I am trying to achieve: To be able to embed the below code

  • 0

What I am trying to achieve:
To be able to embed the below code on a client domain, let’s say client.com which makes a call to the apidomain.com. The client.js script on the apidomain makes an ajax call to a PHP file app.php which is also hosted on apidomain.com. Once the call is made, options are applied and the PHP file responds with the data which is embedded on the client side page.
<script type="text/javascript" src="http://apidomain.com/client.js">
var api_key = 'key';
var opts = true;
</script>

I have the JS and the PHP setup, however everytime the client.js makes a request to the app.php it returns blank, even though the post data goes through. Is this problem related to cross domain ajax request? What would be the correct setup?

  • 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-17T10:53:37+00:00Added an answer on June 17, 2026 at 10:53 am

    You should use this technique its called JSONP. So in a few words:

    1. Create someFunction function (in client.com domain) with parameters you want get from app.php
    2. Send get request by creating script tag with specific parameters in src attribute and callback parameter (/app.php?myvar=hello&callback=someFunction)
    3. In your app.php you create javascript code and echo it, like that: someFunction(/* here you put your parameters);

    So when your script from app.php will be loaded it call someFunction(‘example param1’, ‘example param2’) with parameters you created in app.php

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

Sidebar

Related Questions

I am trying to achieve the following http://www.qksnap.com/i/3hunq/4ld0v/screenshot.png I am currently able to draw
What I'm trying to achieve is: Let inflector slug Ignore a special character in
What I am trying to achieve is editing code in vim then running make
What I'm trying to achieve is say i have an array, i want to
I'm trying to achieve the following: whenever a call to service is performed I
I am trying to achieve a functionality that is able to redirect a user
What I'm trying to achieve here is to be able to select every last
So, I'm trying to achieve the following: The user shall be able to fill
The follow is bad code. Please help me achieve what I'm trying to achieve,
.I'm trying to achieve something with Python where it can intelligently be able to

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.