I have since made some small changes to the source code instead to
shorten the callback instead of specifying one

In line 3421:
                        //jsonp = "jsonp" + jsc++;
                        jsonp = "json"; // Change #1

and line 3450:

                        var ts = now().toString(); //Change #2a
                        // try replacing _= if it is there
                        var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts 
+ "$2");
                        //alert(ts)
                        // if nothing was replaced, add timestamp to the end
                        s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? 
"&" : "?") +
"_=" + ts[7] + ts[8]  : ""); //Change #2b

My web code is now:

<script type="application/javascript">
$.getJSON("http://130.216.208.254:10001/all_data.json?callback=?";,
function(data){
                                                                                
                                                                        
alert("got here");
                                                                                
                                                                        });
</script>

I can see that the response is correct now with firebug, but the alert
is not trigged? Did I break the code somehow with those 2 simple
changes?

On Sep 6, 1:06 pm, Tony <e.sen...@gmail.com> wrote:
> I tried changing the getJSON to your code, it still isn't working, all
> it does is changes the request from the server, still no response in
> the firebug tab.
>
> I tried just leaving ?callback=? and the response is shown in firebug,
> but the problem is my server can't parse an url with that long of a
> callback, that's why I decided to specify the callback.
>
> Any idea?
>
> On Sep 6, 3:20 am, Steven Yang <kenshin...@gmail.com> wrote:
>
> > try 
> > $.getJSON("http://130.216.208.254:10001/all_data.json<http://130.216.208.254:10001/all_data.json?
> > callback=getdata>",
> > getdata);
>
> > i think you might have confused getJSON with the JSONP result
>
> > On Sat, Sep 5, 2009 at 9:50 PM, Tony <e.sen...@gmail.com> wrote:
>
> > > I am using the getJSON command and using firebug for debugging, if I
> > > go to this server i setup with this url:
> > >http://url/all_data.json?callback=getdata
>
> > > It returns json data warped with getdata({data}). I have validated the
> > > json part using jsonlint, so from firebug's net tab I get a param
> > > (callback getdata), header and response, etc. as expected. But if I
> > > use jquery's getjson, I get param, and header but the response is
> > > empty and function callback doesn't trigger (no alert).
>
> > > I have been pulling my hair out trying to solve this for the last few
> > > hours (I know that getjson uses OPTIONS instead of GETS and I can see
> > > that the request is made on the server and the json should be sent as
> > > normal).
>
> > > Here is my code for this section:
>
> > > <script type="application/javascript">
> > > function getdata(data){
> > >        alert(data.name);
> > > }
> > > $.getJSON("http://130.216.208.254:10001/all_data.json?
> > > callback=getdata");
> > > </script>

Reply via email to