-1

I have function like

function someFunc(somevar) {
somevar = typeof(somevar) != 'undefined' ? somevar : 1;

$.ajax({
    url: 'index.php',
    type: 'post',
    data: 'somevar=' + somevar,
    dataType: 'json',
    success: function(json) {
            // smth
        }   
    }
});
}

I want to get $.ajax funciton as object, so I can edit it. Any suggestions are welcomed

5
  • What edits do you want to make to it? Commented Jun 9, 2013 at 22:26
  • It is unclear what you're trying to do. You can replace $.ajax() or edit your own copy of the JS file. Once it's loaded, you can't edit the loaded copy. You could replace it with your own version if you wanted (not sure why though). Commented Jun 9, 2013 at 22:26
  • Basically, I'm interesting in any way to extract one function from another as an object or even a string. Commented Jun 9, 2013 at 22:27
  • Please describe better than you are doing. What does "extract one function from another as an object" mean? Commented Jun 9, 2013 at 22:27
  • jfriend00: I'm making plugin for OpenCart. It already has function someFunc(). I don't want to edit native file. I just want to make JS script which will get function from native file and redefine "success" option. Commented Jun 9, 2013 at 22:32

1 Answer 1

1

If you simply just want to get the result object, just capture the return value. A jqXHR object is returned.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.