Welcome Guest, Not a member yet? Register   Sign In
JSON
#1

[eluser]Unknown[/eluser]
Hello. I have a problem with using the jQuery JSON function $.getJSON in CodeIgniter. The url from which the json is grabbed from is: http://spinly.000space.com/index.php/admin/isloggedin

Now, the problem, is that I have a demo.html file that runs the $.getJSON function and grabs the data from the url I denoted above.

DEMO.html looks like:
Code:
<html>
<head>
  [removed][removed]

  [removed]
  $(document).ready(function(){
  var myurl = "http://spinly.000space.com/index.php/admin/isloggedin/&jsoncallback;=?";

    //myurl = "http://com.lnk.bz/jsonp.php?sleep=3&jsoncallback;=?";
    $.getJSON(myurl,function(adat) {
        alert(adat);
     //   clearTimeout(t);
    });

  });
  [removed]
</head>
<body>
  <div id="images">
  </div>
&lt;/body&gt;
&lt;/html&gt;

So when I run the demo.html file nothing happens, although as you can see it's supposed to alert the data returned, when I change the url to a another one that doesn't use CodeIgniter as the framework I get alert function running, although in this case while using the url that's backed up with CodeIgniter it doesn't work.

Does anyone have a solution to my problem? I'd really appreciate if you gave me some feedback.

Thanks!
#2

[eluser]pistolPete[/eluser]
General advice: Use Firebug to monitor network requests: http://getfirebug.com/

I just tried to access http://spinly.000space.com/index.php/admin/isloggedin/ and I got a valid JSON response.
But if I access http://spinly.000space.com/index.php/adm...oncallback;=? I get
Quote:An Error Was Encountered
The URI you submitted has disallowed characters.

So removing &jsoncallback;=? should solve this issue.
#3

[eluser]Unknown[/eluser]
[quote author="pistolPete" date="1239860568"]General advice: Use Firebug to monitor network requests: http://getfirebug.com/

I just tried to access http://spinly.000space.com/index.php/admin/isloggedin/ and I got a valid JSON response.
But if I access http://spinly.000space.com/index.php/adm...oncallback;=? I get
Quote:An Error Was Encountered
The URI you submitted has disallowed characters.

So removing &jsoncallback;=? should solve this issue.[/quote]



I've tried removing that and nothing.
#4

[eluser]ggoforth[/eluser]
Is this a cross domain Ajax request? If so it shouldn't work. You need to call a dynamic script on your server that can access the data and pass the json back to the requesting javascript. Let me know if that helps.

Greg




Theme © iAndrew 2016 - Forum software by © MyBB