lalnfl Posted June 27, 2011 Share Posted June 27, 2011 Javascript Code: $(document).ready(function(){ // selecting worker if (!document.getElementById("worker_id").value){ document.getElementById("worker_content").innerHTML="<div class='inner_right'>Select a worker to view.</div>"; } $("#worker_id").change(function(){ if (!document.getElementById("worker_id").value){ document.getElementById("worker_content").innerHTML="<div class='inner_right'>Select a worker to view.</div>"; } else { var worker_id = $("#worker_id").val(); $.post("get_worker.php", {worker_id : worker_id}, function(data){ $("#worker_content").html(data); }); } }); // mark down / mark up $("#mark_up").click(function(){ var wage = $("#wage").val(); $("#wage_display").html(wage); }); }); Ajax Callback HTML part: <input type='hidden' name='contract_wage' id='wage' value='$wage' /> <span id='wage_display'>$$wage</span> <input class='form' type='button' name='mark_up' id='mark_up' value='Mark Up' /> What is causing it to not function? Quote Link to comment Share on other sites More sharing options...
gristoi Posted June 27, 2011 Share Posted June 27, 2011 where are you declaring the id worker_id? Quote Link to comment Share on other sites More sharing options...
lalnfl Posted June 27, 2011 Author Share Posted June 27, 2011 I seemed to have fixed my problem by placing the javascript code that I want to run with the ajax callback in that. Quote Link to comment 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.