| Issue 446: | Using AJAX-option and relative url causes problem | |
| 4 people starred this issue and may be notified of changes. | Back to list |
What steps will reproduce the problem?
The following code does not work:
$.nyroModalManual({
url: 'test2.asp',
ajax: {data: 'test=wiiiiiiiI', type: 'post'}
});
where
test2.asp is generating plain html.
However, it works if the full url is included. Hence the below code works:
$.nyroModalManual({
url: 'http://www.mydomain.com/test2.asp',
ajax: {data: 'test=wiiiiiiiI', type: 'post'}
});
What is the expected output? What do you see instead?
I expect to see the content of test2.asp (in this case just plain html for
simplicity). However, the AJAX-request does not seem to load (according to
Firebug no AJAX-requests are made). Instead I see the loader gif until I
close the nyroModal by clicking outside of it.
This happend when I updated from 1.5.2. to 1.6.2 and after some digging I
discovered that by removing the following line it starts to work again:
"callingSettings = $.extend(true, settings);" (Line 341 in 1.6.2)
This line was added in 1.5.4. What is more interesting though is that I get
a javascript error in 1.5.4 (that I did nog get in 1.6.2):
"$.ajax is not a function"
This error referred to the following line:
"$.ajax($.extend(true, currentSettings.ajax, {" (Line 513 in 1.5.4 or Line
512 in 1.6.2)
Mar 18, 2010
#1
carljoha...@gmail.com
Mar 18, 2010
Oh, proper(?) solution:
I wrong syntax was used for the $.extend (Line 341 version 1.6.2). A proper syntax
would be:
callingSettings = $.extend(true, {}, settings);
Please add to next release if you think it is good enough and not messing up anything
else.
Thanks!
Apr 3, 2010
Thx for telling me about your issue, I should have found it before posting mine :) Btw, your fix seems to do a wrong thing, as the callingSettings variable gets completely overriden, i.e. it's equal to this: callingSettings = settings; I'm pretty sure (according to this page http://api.jquery.com/jQuery.extend/) it should be so: $.extend(callingSettings, settings); In this case it will properly merge the settings.
Apr 3, 2010
You most certainly have a point - to be honest I was a little bit confused myself.
The reason why I went for the "true, {}" -solution was since he (the creator) already
had "true" in his statement. He also uses that syntax in other cases.
Another reason why I went for my solution was because the variable callingSettings is
not set before that line is executed - at least not what I could find out (unless
that line in another call was executed).
Anyway, I'm glad you found the solution :) I just hope mr NyroModal will include it
in the code and make a new release soon!
Apr 17, 2010
This will be fixed in the next release. Thanks for your report.
Status:
Duplicate
Mergedinto: 433 |