javascript - PHP function + Jquery + Ajax -



javascript - PHP function + Jquery + Ajax -

i cant create work. have php script on website (not in php, if wrong, please point me). , want phone call js document.

<?php function doit($option){ if ('getit' == $option){ $value = '318273918739182739179'; homecoming $value; }else{ homecoming 0; } } ?>

and want phone call js file. how pass argument php script via ajax?

var getanswer ={ php: function(){ $.ajax({ url:'mywebsite.com/php/return.php', data: {action, 'doit'}, type: 'post', success: function(output){ alert(output); } }) } }

in javascript:

$.get('yourphpscript.php?argument='+some_arg,function(data){ //data contain result php script });

in yourphpscript:

$option = $_get['argument']; if ('getit' == $option){ $value = '318273918739182739179'; echo $value; }else{ echo "0"; }

php javascript jquery html ajax

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -