sc_ajax_javascript return value?

Hi! :smiley:
I am trying to call a javascript method by using sc_ajax_javascript,
but is there anyway to retrieve the return value from the javascript method?

I don’t believe so as JS runs on client side and PHP runs on server side.

One way around it is to get the JS to create a small text file with a status / return value in it, and then get your PHP to check / read that file. Make sure you clean up before / afterwards…

javascript return method by using sc_ajax_javascript

[QUOTE=Brian;29641]Hi! :smiley:
I am trying to call a javascript method by using sc_ajax_javascript,
but is there anyway to retrieve the return value from the javascript method?[/QUOTE]

Would need to know the method to pass a variable / result from javascript to php.

I have a form, and the ‘OnValidate’ event
I need to grab the return value of a function in javascript.
The function of javascript, would have to modify the field_Result {} field and return a result to php.
I’ve tried using the macro sc_ajax_javascript (), but it has not worked for me. But if I could pass a variable from php to javascript with the macro
sc_ajax_javascript (‘Param1’, ‘Param2’);

The code I use is as follows:

php (OnValidate) -----

sc_ajax_javascript (‘ValidarOpcion’);
if ({field_Result == ‘yes’) {OpenForm}
…

javascript ------

ValidarOpcion () {
if (confirm (‘Would you like continue?’)) {

       Field_Result {} = 'True';

} Else {

      Field_Result {} = 'False';

}
}

I have also tried to use the javascript function within the php code with:

echo “<script> confirm (‘Testing Javascript in PHP events’); </ script>”;

but I could not capture the results confirm ()

$ Var = echo “<script> confirm (‘Testing Javascript in PHP events’); </ script>”;

Thanks in advance

see post above yours.

The answer is not “easily” because the JS and PHP bits run at different times (one on server and one on client)

[QUOTE=adz1111;33685]see post above yours.

The answer is not “easily” because the JS and PHP bits run at different times (one on server and one on client)[/QUOTE]

Alternative ???

I use php to javascript option because not know another way to do it. The point is I want to run the php code, send a message to the user to
‘Accept’ or ‘cancel’ and function of the option selection, php execute one form or another grid.

Alternative option:

javascript saved text file with variables and values. Since php read the file generated in javascript and parseamos to recover the variable and its values.

Create a javascript function thath calls a php file, using POST GET to pass variables, control from JS returning values and confirmation dialogs. “Easy”