Skip to main content

Search and Top Navigation

#14975 closed bug (notabug)

Opened May 24, 2016 01:05PM UTC

Closed May 24, 2016 01:13PM UTC

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:
Description

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
Attachments (0)
Change History (1)

Changed May 24, 2016 01:13PM UTC by scottgonzalez comment:1

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.