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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:24:46+00:00 2026-06-11T09:24:46+00:00

I am trying to make crossdomain calls using jQuery, but so far pretty unsuccessful.

  • 0

I am trying to make crossdomain calls using jQuery, but so far pretty unsuccessful. My HTML file is on my ‘C:/Temp’ folder name ‘test.html’. My HTML code is below —

<!DOCTYPE html> 
<html> 
    <head> 
    <title>My Page</title> 
    <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
</head> 
<body> 
<input id="first_name" type="text" value="khan" />
<input id="clickme" type="button" value="Click Me!"/>

<script type="text/javascript">
    $(document).ready(function() {
        $("#clickme").click(function(){
            $.ajax({
                url: 'http://localhost:8008/qm/profile/' + $("#first_name").val() + "/",
                type: "GET",
                dataType: "jsonp",
                crossDomain : true,
                success: function(response)
                    {
                        alert(response.responseText);
                    },
                error: function()
                    {
                        alert("fail");
                    },
            });
        });
    });

</script>

</body>
</html>

Now on the server side I have a little python code that looks like this —

def profile(request, username):
    fullname = ''
    if username == 'khan':
        fullname = 'Khan Hannan'
    data = {'fullname': fullname}
    print data
    return HttpResponse(json.dumps(data))

The python code is inside DJango project. If I make a straight call to the URL (‘http://localhost:8008/qm/profile/khan&#8217;), I get a JSON response back from my server, but when I put the same URL through jQuery, I don’t get any response and it fails.

Any suggestion?

  • 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-11T09:24:47+00:00Added an answer on June 11, 2026 at 9:24 am

    JSONP works by wrapping your JSON in a function and then executing the function to get the code object.

    This is done by sending a callback querystring value to the server which it is then suppose to wrap the JSON object with.

    If you inspect the request going out to your server you should see a value being send along called callback=jquery[long number].

    http://en.wikipedia.org/wiki/JSONP

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

Sidebar

Related Questions

I am trying to make a jQuery get() AJAX call, but the response is
I'm trying to call Google Places API 1 using jQuery but it seems to
Trying to make this jQuery filter that uses .find case-insensitive. For example, when the
Trying to make a small countdown timer in my app but it's not working.
I'm trying to make a jQuery $.getJSON call to the Google Maps Geocoding webservice
I'm trying to access a 3rd party api over http using jquery .ajax (or
I'm trying make one treeView with infinite subgroups. I can add my groups but
I'm trying to make a change to an old appengine application, but now after
I am trying make a segue call in a tableview , but the application
I'm trying make a <dl> to define the icons I am using on 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.