I have a object .
reqeuest ={"_command":".login","username":"rahul","password":"12345"}
i want to add
{'on':{
login:function(){
console.log("logged in ");
},
error:function(){
console.log("oops error ");
}
}}
So it will become like it :
{
"_command":".login","username":"rahul","password":"12345",
'on':{
login:function(){
console.log("logged in ");
},
error:function(){
console.log("oops error ");
}
}}
what i tried is
request=$.extend(request,{'on':{
login:function(){
console.log("logged in ");
},
error:function(){
console.log("oops error ");
}
}});
or
hash.extend(request,{'on':{
login:function(){
console.log("logged in ");
},
error:function(){
console.log("oops error ");
}
}});
but it is not doing the what required what should i do ?
You should do this:
To test it, go to Script tab in firebug, and write ‘request’ on the ‘Watch’ tab. It’s working.
Cheers