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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:32:06+00:00 2026-06-01T00:32:06+00:00

I have a web service and I’m trying to get data by JSON. if

  • 0

I have a web service and I’m trying to get data by JSON. if I access within the same server works fine but when I upload it to the hosting it doesn’t work. the problem is the “?callback=?” param. with chrome i see the returned json but the code below didn’t show it in the input text:

   <html><head> <script src="jquery-1.7.1.min.js"  type="text/javascript" ></script>
    <script>
        $(document).ready(function()
        {   
            $("#cons").click(function(){
                alert("wait");
                var nombre = $("#nombre").attr('value');
                if(nombre!==''){
                    var today = new Date();
                    var mm = today.getMonth()+1; //January is 0!
                    var yyyy = today.getFullYear();

                    $.getJSON("http://grup15.mihost.info/index.php/WS/Api/user/nombre/"+nombre+"/ano/"+ yyyy +"/mes/"+mm+"/format/json?callback=?", function(data) {

                        var htmlResult = "";
                        $.each(data, function(key, val) {
                            htmlResult += val.total;
                        });

                        $('#gasto').attr('value',htmlResult);
                    });
                }else{
                    alert("Nombre Necesario");
                }
            });
        });
    </script>
</head>
<body>
    <table>
        <tr>
            <td>Nombre:</td>
            <td><input type="text" id="nombre" value=""/></td>
        </tr>
        <tr>
            <td>Gasto De este mes:</td>
            <td><input id="gasto" type="text" value=""/></td>
        </tr>
        <tr><td colspan="2"><button id="cons" type="button">Consultar</button></td></tr>
    </table>


</body>

If i delete the “?callback=? chrome shows: “not allowed by Access-Control-Allow-Origin”
what i have to do??? thanks for the help!

  • 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-01T00:32:07+00:00Added an answer on June 1, 2026 at 12:32 am

    ?callback=? means JSONP, which means the server should return JSONP, not JSON.

    JSONP is actually a script, that looks like so:

    func({data: 123, test: 456});
    

    Your data needs to be wrapped in the value of the callback parameter.

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

Sidebar

Related Questions

I have a web service that queries data from this json file, but I
I have a web service deployed on a server instance. On the same instance,
I have a web service that uses Python's SimpleJSON to serialize JSON, and a
I have web service written that generates some data...can I call the web service
I have web service installed on application server. Security and SSO provides by placing
I have a web service with some data that I need to pass across
I have php web service. and can consume it from php client. But problem
I have a web service which access 2 other web services. I need to
I have implemented web service using rails server. The server uses rails default authentication
I have a web service from which i receive data, put it in a

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.