Skip to content

Namespace Method as jsonp callback name #1865

Closed
@chentsulin

Description

@chentsulin

Is it possible to use namespace method as a jsonp callback name ?

With jQuery 1.11.1

var callback = function() {};
window.mynamespace = window.mynamespace || {};
window.mynamespace.callback = callback;

$.ajax({
     url: 'http://localhost:3000/',
     dataType: 'jsonp',
     jsonp: 'callback',
     jsonpCallback: 'mynamespace.callback',
     success: function() {
           alert('SUCCESS!');
     },
     error: function() {
          alert('ERROR!');
     }
});

After server respense, mynamespace.callback was called.
But get Error: mynamespace.callback was not called and alert Error.

Could I only use global function as jsonp callback name?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions