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 <ricardob...@gmail.com> wrote:
> 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
> <script> tag. Think of it like this:
>
> // in your .JS file
> <script>
> function shake(data){
>   alert( data.stuff );};
>
> </script>
>
> // now you callwww.jsonp.com/get?format=json&callback=shake, and you
> get this string back:
> shake({ stuff: [1,2,3] });
>
> What happens here, is that there is *no* ajax involved. It all happens
> as if you simply put this into your document:
>
> <script type="text/javascript" src="http://www.jsonp.com/get?
> format=json&callback=shake"></script>
>
> The response text is a new script that contains the data in the
> function (which must be defined before that) call.
>
> Well, this is already far off from your question, it depends on what's
> running server-side etc. Maybe if you could mention which plugin
> you're using or provide a test page this could be solved easily.
>
> cheers
> -- ricardo
> On Jul 1, 4:12 pm, Rick Faircloth <r...@whitestonemedia.com> wrote:
>
>
>
> > 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 <ricardob...@gmail.com> wrote:
>
> > > 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(data)
> > > {
> > >     alert(data.errors[0]);
> > > });
>
> > >http://docs.jquery.com/Ajax/jQuery.getJSON#urldatacallback
>
> > > On Jul 1, 10:16 am, theozmanbo <b.k.osbo...@hotmail.com> wrote:
> > > > 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-tp24283450s2...
> > > > Sent from the jQuery General Discussion mailing list archive at
> > > Nabble.com.
>
> > --
> > --------------------------------------------------------------------------- 
> > -----------------------------------------------------------------------
> > "Ninety percent of the politicians give the other ten percent a bad
> > reputation."  Henry Kissinger

Reply via email to