getting UNDEFINED when trying to use USER_AJAX function

Hi there,

I have been grappling with this for some hours now and need advise:
I have simplified the ajax function just to ensure that a value gets returned before putting back the real workings.

I have a 7.js file which contains the following function which gets called from the elements "on change" java:

function clear_uif() {
var url = 'http://www.databook.co.za/lptenders/index.php?option=com_fabrik&format=raw&view=plugin&task=userAjax&method=clear_uif';
var invite_id = 4;
new Request({
url: url,
data: {
method: 'clear_uif', 'invite_id':invite_id
},
onComplete:function(r){
form_7.formElements.get('tender_invitees___tender_info_status').update(r);
}
}).send();
};


(if I change the "update(r) to say "update("test") it actually returns test to the element nominated in the function. If I put it back to "update(r)" the field receives "undefined"


The simplified user_ajax function reads:

function clear_uif() {
$answer = "Hello";
echo $answer;
}
 
Have you run a JS debugger (like FireBug, or Chrome dev tools) and put in break points in your onComplete function, to see what 'r' contains?

-- hugh
 
Hi Hugh,

I have started firebug but do not cannot see where to find the oncomplete function?

in which section will this be given that it is actually in the 7.js?

(sorry, I have never done this level of debugging)
 
In chrome developer tools look under resources and you will see the 'onComplete' part of your js function. you can set a breakpoint to pause code execution and examine the value of the code elements. I am sure that firefox/bug has similar views but it is not my bag... Generally if you are getting 'undefined' it is likely that your script is trying to use a var which is being set to null because there is an error in the var assignment statement, or it is out of range... Cant be more help without looking at it directly.
Good luck.

[In chrome right-click and select 'inspect element' to open dev tools]
 
I always use Firebug, as I just find the debugger easier to use, makes more efficient use of the screen real estate. Chrome dev tools always feel like they are designed to only really work well in 'floating' mode, with dev tools in their own window. Which is great if you are on a desktop with big and / or multiple monitors. But I do all my work on a laptop, where screen space is precious.

@countrytrash - if you can point me at the page, I can take a look with Firebug.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top