10 Replies - 1399 Views - Last Post: 05 May 2013 - 02:11 AM

#1 amit.soni  Icon User is offline

  • D.I.C Head

Reputation: 26
  • View blog
  • Posts: 73
  • Joined: 19-November 10

$.getJSON not working in any other browser except mozzila

Posted 04 May 2013 - 11:01 AM

hi programmers,

Now, i am working with search twitter api,
getting the tweets on query in json format,
it's working fine on mozilla , but not working in any other browser[chrome,safari,ie9,opera]
it shows error like Uncaught SyntaxError: Unexpected token ILLEGAL

tell me where i am going wrong & suggest me the proper way.

here's the working[on MOZILLA] Fiddle

Thanks,
Amit

Is This A Good Question/Topic? 0
  • +

Replies To: $.getJSON not working in any other browser except mozzila

#2 andrewsw  Icon User is offline

  • It's just been revoked!
  • member icon

Reputation: 3838
  • View blog
  • Posts: 13,595
  • Joined: 12-December 12

Re: $.getJSON not working in any other browser except mozzila

Posted 04 May 2013 - 11:14 AM

Quote

shows error like Uncaught SyntaxError: Unexpected token ILLEGAL

This means there is an error - a syntax error - in your code and it won't work. Find the line that the error is on and correct it.

If you are unable to fix it then post the line(s) that it refers to together with the full error message.

If the error originates from the json data returned then this data is malformed in some way.

This post has been edited by andrewsw: 04 May 2013 - 11:16 AM

Was This Post Helpful? 0
  • +
  • -

#3 laytonsdad  Icon User is online

  • Cheese and Sprinkles
  • member icon

Reputation: 451
  • View blog
  • Posts: 1,948
  • Joined: 30-April 10

Re: $.getJSON not working in any other browser except mozzila

Posted 04 May 2013 - 11:14 AM

Try using the $.post $.get shortcut using json encoding

$.get("your.url", {get: data}, function(data){
   //do work with returned json object data
}, "json");


This post has been edited by laytonsdad: 04 May 2013 - 01:52 PM

Was This Post Helpful? 0
  • +
  • -

#4 amit.soni  Icon User is offline

  • D.I.C Head

Reputation: 26
  • View blog
  • Posts: 73
  • Joined: 19-November 10

Re: $.getJSON not working in any other browser except mozzila

Posted 04 May 2013 - 11:27 AM

Here's the error on console on chrome

Attached Image

when i click the link next to error message , it shows this on new tab

Attached Image
Was This Post Helpful? 0
  • +
  • -

#5 andrewsw  Icon User is offline

  • It's just been revoked!
  • member icon

Reputation: 3838
  • View blog
  • Posts: 13,595
  • Joined: 12-December 12

Re: $.getJSON not working in any other browser except mozzila

Posted 04 May 2013 - 11:40 AM

You probably need to url encode the question mark at the end: "callback=%3F"

This post has been edited by andrewsw: 04 May 2013 - 11:47 AM

Was This Post Helpful? 0
  • +
  • -

#6 amit.soni  Icon User is offline

  • D.I.C Head

Reputation: 26
  • View blog
  • Posts: 73
  • Joined: 19-November 10

Re: $.getJSON not working in any other browser except mozzila

Posted 04 May 2013 - 11:49 AM

you mean to say something like this

http://search.twitter.com/search.json?q=dreamincode&callback=%3F


but it's not working :(/>/>

This post has been edited by Dormilich: 06 May 2013 - 07:09 AM

Was This Post Helpful? 0
  • +
  • -

#7 andrewsw  Icon User is offline

  • It's just been revoked!
  • member icon

Reputation: 3838
  • View blog
  • Posts: 13,595
  • Joined: 12-December 12

Re: $.getJSON not working in any other browser except mozzila

Posted 04 May 2013 - 11:53 AM

Does it produce the same errors as before?
Was This Post Helpful? 0
  • +
  • -

#8 amit.soni  Icon User is offline

  • D.I.C Head

Reputation: 26
  • View blog
  • Posts: 73
  • Joined: 19-November 10

Re: $.getJSON not working in any other browser except mozzila

Posted 04 May 2013 - 12:05 PM

it's not producing any error,in fact this time it's not fetching the url.
crome console shows no error but firefox show this

Attached Image

This post has been edited by Dormilich: 06 May 2013 - 07:09 AM

Was This Post Helpful? 0
  • +
  • -

#9 andrewsw  Icon User is offline

  • It's just been revoked!
  • member icon

Reputation: 3838
  • View blog
  • Posts: 13,595
  • Joined: 12-December 12

Re: $.getJSON not working in any other browser except mozzila

Posted 04 May 2013 - 12:25 PM

If you are testing this locally then test it remotely, as Google Chrome gives me the error:

Origin null is not allowed by Access-Control-Allow-Origin

(even with the option of "--allow-file-access-from-files").

..and click on the Net tab in Firefox's console.

This post has been edited by andrewsw: 04 May 2013 - 12:24 PM

Was This Post Helpful? 0
  • +
  • -

#10 amit.soni  Icon User is offline

  • D.I.C Head

Reputation: 26
  • View blog
  • Posts: 73
  • Joined: 19-November 10

Re: $.getJSON not working in any other browser except mozzila

Posted 04 May 2013 - 09:42 PM

i uploaded the file in free webhosting,
but it still not working on any browser

here is the link

This post has been edited by Dormilich: 06 May 2013 - 07:08 AM

Was This Post Helpful? 0
  • +
  • -

#11 amit.soni  Icon User is offline

  • D.I.C Head

Reputation: 26
  • View blog
  • Posts: 73
  • Joined: 19-November 10

Re: $.getJSON not working in any other browser except mozzila

Posted 05 May 2013 - 02:11 AM

i don't know how and why... but this morning when i again try to load that fiddle in chrome,opera,ie9,safari it works. :)/>/>/>

[SOLVED]

crazy world of browsers :)/>/>/>

This post has been edited by Dormilich: 06 May 2013 - 07:08 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1