Thanks everyone. as it turns out it was that stupid uploadPictures thing.
That happened because in the php script I was echo'ing it to test something
and forgot to remove it. Once it was there and I was testing JSON I guess it
looked natural to me and I didn't notice that it was wrong? I simply r
missed that!
On Jul 2, 4:48 am, mkmanning wrote:
> uploadPicture{"errors":["This file was already uploaded"]}
>
> isn't valid JSON or JSONP
>
> if uploadPicture is a callback function then it needs ( ) :
>
> uploadPicture( {"errors":["This file was already uploaded"]} );
>
> On Jul 1, 9:25 pm, R
uploadPicture{"errors":["This file was already uploaded"]}
isn't valid JSON or JSONP
if uploadPicture is a callback function then it needs ( ) :
uploadPicture( {"errors":["This file was already uploaded"]} );
On Jul 1, 9:25 pm, Ricardo wrote:
> No. JSONP provides a way to pass the JSON resp
No. JSONP provides a way to pass the JSON response directly to a
callback function without the need for eval(), independent of what
you're doing with it. It was conceived to allow cross-domain use of
JSON, 'cause you don't get the response from XHR but from an appended
tag. Think of it like this:
theozmanbo wrote:
uploadPicture{"errors":["This file was already uploaded"]}
That is not valid JSON.
If you were returning
{"errors":["This file was already uploaded"]}
You would have more luck. In fact I'm willing to bet you'd be able to
do something like alert(data.errors[0]) - becaus
So...am I to understand that jsonp provides a method by which an image can
be uploaded after submission of a form as part of a callback function? I've
done
some research on jsonp, but still am not clear about it.
Rick
On Wed, Jul 1, 2009 at 1:03 PM, Ricardo wrote:
>
> that is called jsonp. You
that is called jsonp. You need to define a function named
uploadPicture that will get called when the response arrives. jQuery
handles that for you if you use the proper method (assuming the
callback name can be set in the request):
$.getJSON('uploadpicture.php?callback=?, {some:'data'}, function
Yes, it is because of that part
I'd suggest, despite the silly title, reading this blog post
http://blog.archive.jpsykes.com/67/how-to-explain-json-to-your-mum/index.html
On Jul 1, 9:16 am, theozmanbo wrote:
> Is it because of the uploadPicture part? Why isn't it valid? Sorry for all
> these s
Is it because of the uploadPicture part? Why isn't it valid? Sorry for all
these stupid questions.
--
View this message in context:
http://www.nabble.com/simple-JSON-parse-problem%21%21%21-tp24283450s27240p24289615.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.
uploadPicture{"errors":["This file was already uploaded"]}
isn't valid JSON
and even
var JSON = eval("("+data+")");
resulting in
(uploadPicture{"errors":["This file was already uploaded"]} )
isn't valid JSON... hence eval() and expecting it to act like an
object is never going to work
On Jul 1
Okay - well here's what I'm really doing. I'm using an ajax upload plugin and
in the callback function, which returns a variable "data", I need to parse
it into a JSO so I can use it. Right now it's just a string.
onComplete: function(file, data) {
$('
As mentioned in another reply, "theObject" is an object.
So, building a string with
"(" + theObject + ")";
will not give you what you'd expect. If that were to work at all you'd
likely end up with a string of "([Object])" - not what you want.
If you really must do the eval(), then it shoul
What is the purpose of the eval() ? as the line
var theObject = {"key": "value"};
*IS* a "json" object
alert(thiObject.key) will show you "value"
On Jun 30, 11:09 pm, theozmanbo wrote:
> Why won't this work??? Nothing pops up for the alert.
>
>
>
> var theObject = {"k
13 matches
Mail list logo