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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:27:13+00:00 2026-06-04T04:27:13+00:00

I’m am very confused regarding the callback function while using jsonp Here is my

  • 0

I’m am very confused regarding the callback function while using jsonp

Here is my js file in json format
http://asla.dev.1over0.com/Guide/js/testjson.js

Essentially it’s this json

{"x": 10, "y":15} 

This is the data I will be retrieving
Here is my website the client who wants to take in the data from the js file that lives cross-domain
http://www.waveofcolor.com/faq.php
in order for me to retrieve that data in the js file I have to include the js file
http://asla.dev.1over0.com/Guide/js/testjson.js within a script tag
and also declare a function to tell the page what to do with this data
here is the code

function func(json){
alert(json.x) 
}
<script type="text/javascript" src="http://asla.dev.1over0.com/Guide/js/testjson.js"></script>

I guess this is the part in which I am confused; I’ve read so far that you pretty much just add a query string to the end of the js file you are calling within the script tag

<script type="text/javascript" src="http://asla.dev.1over0.com/Guide/js/testjson.js"></script>

will now be

<script type="text/javascript" src="http://asla.dev.1over0.com/Guide/js/testjson.js?jsonp=func"></script> 

My question is… How does jsonp know to call the func function?
Would this need to be set up on the back end?
If so how does one set this up using either PHP or .NET 4.0 Framework.
I got jsonp to work if I hardcode and call the func function within the js file like so

func({ "x": 10, "y": 15});

But it doesn’t make sense to call the actual function within the js file right?

As always any input is appreciated

  • 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-04T04:27:14+00:00Added an answer on June 4, 2026 at 4:27 am

    Yes, you’re correct. True JSONP requires back-end support. Normally, the JSON you’re returning will also be dynamic. If it’s not (there’s just one chunk of data everyone shares), hard-coding a function name (pick a better one than func) is crude but effective.

    If you want actual JSONP, there are various ways to do it on the backend. See this trivial PHP example and this question about JSONP on ASP.NET MVC

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I am reading a book about Javascript and jQuery and using one of the
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
In my XML file chapters tag has more chapter tag.i need to display chapters
I am trying to render a haml file in a javascript response like so:

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.