thisisnuts123 Posted October 16, 2007 Share Posted October 16, 2007 function onDrop() { var data = DragDrop.serData('g1'); x_sajax_update(data, confirm); <?php $hello = update_dropbox(); ?> var l="<?php echo $hello; ?>"; alert(l); } above code is a javafuntion which is calling the php funtion update_dropbox(); this funtion then return a variable.. if i check my debuger up to this point it;s good but now $hello = update_drop()' seems to return nothing.. so when i alert empty box pops out.. is there another way to get value out of the update_dropbox(); i tested function getId() { var x=document.getElementById("dropBox"); var dropboxid=DragDrop.getDropBoxid('g1', null); alert(dropboxid); <?php $Boxid = "thisisatest"; ?> var s="<?= $Boxid ?>"; alert(s); } and i actualy get a alert says thisis a test.. so i guess there is someting wrong with $hello = update_dropbox(); part of the code can any one help me with this? Quote Link to comment https://forums.phpfreaks.com/topic/73393-solved-need-help-understanding-this-code/ Share on other sites More sharing options...
kratsg Posted October 16, 2007 Share Posted October 16, 2007 Where is the function "update_dropbox()" located in your code (if at all?) If that function is missing, then it will report a Call to Undefined Function on line such and such. If it's there, can you post that as well? Quote Link to comment https://forums.phpfreaks.com/topic/73393-solved-need-help-understanding-this-code/#findComment-370282 Share on other sites More sharing options...
trq Posted October 16, 2007 Share Posted October 16, 2007 PHP has long been processed (server side) prior to any javascript (client side) function being called. You really need to rethink your entire logic. Maybe look into some Ajax tutorials. In order to have javascript (client side) execute a php (server side) function you need to make another request to the server. There is a great little ajax tutorial here written by the guy who wrote the first versions of php. Quote Link to comment https://forums.phpfreaks.com/topic/73393-solved-need-help-understanding-this-code/#findComment-370283 Share on other sites More sharing options...
thisisnuts123 Posted October 16, 2007 Author Share Posted October 16, 2007 i been reading many topics and they all talk about making requst using get post method i need to make a request with out any get post.. the page should not be refreshed is this posible? Quote Link to comment https://forums.phpfreaks.com/topic/73393-solved-need-help-understanding-this-code/#findComment-370310 Share on other sites More sharing options...
trq Posted October 16, 2007 Share Posted October 16, 2007 Yes its possible using ajax. Have another read of the link I gave you. Quote Link to comment https://forums.phpfreaks.com/topic/73393-solved-need-help-understanding-this-code/#findComment-370311 Share on other sites More sharing options...
thisisnuts123 Posted October 16, 2007 Author Share Posted October 16, 2007 ok thanks !! Quote Link to comment https://forums.phpfreaks.com/topic/73393-solved-need-help-understanding-this-code/#findComment-370313 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.