this question has answer here:
i'm having problem code below:
jquery
var data = $('thisform').serialize(); var msg = <?php echo computeaverage(data)?>; alert(msg);
php
function computeaverage($data){ return $data; }
i'm getting " data"(string) output , not actual value of data. way, use 1 php file contains jquery , php function above.
your appreciated. need figure out. i'm new jquery.
thank replies. given need place php function separate file
jquery
var url = "myphpfunction.php"; var data = $('thisform').serialize(); $post(url,data, function(response)); // how can reponse url?
php
function computeaverage($data){ // how convert $data array? return average; // how can return average jquery? }
can me? thanks
php code executed on server before client starts executing javascript. code within <?php ?>
executed first.
after php code has been executed, send output client like:-
var data = $('thisform').serialize(); var msg = data; // echo executed alert(msg);
now javascript
start executing.
the php not consider javascript variable data
part of client-side scripting.
Comments
Post a Comment