iosrockstar / jquery-jsonp

Automatically exported from code.google.com/p/jquery-jsonp
0 stars 0 forks source link

functions passed in data is executed #38

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Im trying to pass a callback-function that I want to use however I make use of 
some steps for all calls so I want the success-handler to be used in the 
jsonp-function, but then the callback I specify should be called. For some 
reason I don't understand (not saying it is a problem in jquery-jsonp but I 
don't understand why it would behave this way) any reference to a function I 
pass to the data-object is executed before the XHR is even fired up. 

What steps will reproduce the problem?
I made a fiddle showing the problem at: 
http://jsfiddle.net/rtTN3/2/

What is the expected output? What do you see instead?
I expect the jsonp() not to eval each property in data before making the 
request. Instead any code in data is executed before request is sent.

What version of the product are you using? On what operating system?
jQuery1.7, latest jquery-jsonp

Original issue reported on code.google.com by kan...@gmail.com on 9 Nov 2011 at 3:52

GoogleCodeExporter commented 8 years ago
I'm having the same problem, callbacks are called before getting the xhr.

Original comment by enri...@markhaus.com on 19 Nov 2011 at 7:22

GoogleCodeExporter commented 8 years ago
I truly don't get what you're trying to achieve here. And the jsfiddle is just 
full of very basic errors that make it impossible to understand your problem.

Please, provide a reduced test case demonstrating the issue.

Original comment by jul...@creative-area.net on 12 Dec 2011 at 4:19

GoogleCodeExporter commented 8 years ago
I didn't find my complex at all and it lints just fine. I also thought that my 
explanation of the problem would make it clear had the code been confusing. I 
don't expect the function passed as parameter in my data-object to be run 
before the XHR is placed.

http://jsfiddle.net/rtTN3/5/

This would show alert 'foo', then as a result of of success i $.jsonp() show 
alert 'done'. It should only show 'done' and not 'foo'. It seems to eval each 
property of the object before sending the XHR.

Original comment by kan...@gmail.com on 12 Dec 2011 at 4:41

GoogleCodeExporter commented 8 years ago
Your first example was: http://jsfiddle.net/rtTN3/2/ which IS throwing js 
errors all over the place. As to your second one ( http://jsfiddle.net/rtTN3/5/ 
) you don't even add the jsonp plugin as a resource.

What don't get is why oh why you'd put a function into data that are to 
serialized and sent over the wire ? This does not make any kind of sense.

Original comment by jul...@creative-area.net on 12 Dec 2011 at 5:02

GoogleCodeExporter commented 8 years ago
No answer in 3 days. Closing as invalid.

Original comment by jul...@creative-area.net on 15 Dec 2011 at 5:26