1

I am trying to debug some JQuery ajaxSetUp behaviour. I set a timeout value and wish to see it set in the debugger. To do this I need to know what to watch while debugging. To investigate where the timeout is set, I do the following in a firefox console:

var obj = jQuery.ajaxSetup({
    timeout: 120000
});
console.log("obj=" + obj.timeout)

I want to find out what type of object obj is? I know JavaScript is dynamically typed but if I can find out what object it is then I know what to add a watch to when debugging.

1
  • You want to know that obj is really an object from ajax Setup? Not going to happen. Commented Apr 29, 2013 at 14:07

5 Answers 5

3

Type of obj is object. See:

typeof obj
// "object"

Also, the constructor is global javascript Object. Here:

obj.constructor.name
// "Object"
Sign up to request clarification or add additional context in comments.

Comments

2

jQuery has a few utility methods like .isArray(), .isFunction(), .isNumeric() and .isPlainObject() that return true or false. Use these one after the other to determine whether an object is of a specific type.

Comments

1

there is special function in jquery

jQuery.type(obj)

Comments

1

You can use the typeof operator.

Comments

0

This wasn't a good approach for this problem. I looked at the JQuery source and saw when you invoke ajaxSetUp it updates the jQuery.ajaxSettings object.

So if you do...

console.log(jQuery.ajaxSettings.timeout)

in the debug console you'll get the value.

I am putting answer here in case it is use to anyone.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.