Calling and writing jquery/javascript functions
Posted
by Ankur
on Stack Overflow
See other posts from Stack Overflow
or by Ankur
Published on 2010-04-19T06:20:30Z
Indexed on
2010/04/19
6:33 UTC
Read the original article
Hit count: 258
I think I have not got the syntax correct for writing a javascript function and calling it to assign its return value to a variable.
My function is:
getObjName(objId){
var objName ="";
$.ajax( {
type : "GET",
url : "Object",
dataType: 'json',
data : "objId="+objId,
success : function(data) {
objName = data;
}
});
return objName;
}
I am trying to call it and assign it to a variable with:
var objName = getObjName(objId);
However Eclipse is telling me that "the function getObjName(any) is undefined"
© Stack Overflow or respective owner