Opened 7 years ago

Closed 7 years ago

#14975 closed bug (notabug)

Problem assigning string to .AJAX URL property

Reported by: radsolution Owned by:
Priority: minor Milestone: none
Component: ui.core Version: 1.11.4
Keywords: Cc:
Blocked by: Blocking:


When attempting to set the url to a constructed value using an anonymous function:

$.ajax({url:function () {
                    var url = ... // construct URL here
                    return url;

I discovered that the url became set to a string which contained the function definition,
rather than the string value which is returned from that function.

This appears to me to be a bug.

There is a workaround, using javascript's IIFE construct thus:

$.ajax({url: (function () {
                    var url = ... // construct URL here
                    return url;
              )() // using IIFE

Change History (1)

comment:1 Changed 7 years ago by Scott González

Resolution: notabug
Status: newclosed

This is not part of jQuery UI. But I can tell you that you "workaround" is not a work around, it's the correct implementation.

Note: See TracTickets for help on using tickets.