Java Script Not Working?-VBForums
Results 1 to 2 of 2

Thread: Java Script Not Working?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2008
    Reading, UK

    Java Script Not Working?

    Hi there

    Im having a bit of a problem getting some Javascript on my html page working properly

    This is my Html File

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script src="javascripts/jquery-1.9.0.js" type="text/javascript"></script>
    	<Script type="text/javascript">
    	function GetVehicles(){
    			var regpart=document.getElementsByName('serstr')[0].value;
    			var items="<option value='0'></option>";
    				var item="";
    					items+="<option value='"+item.VehicleId+"'>"+item.Vehicle+"</option>";
    	function GetInvoices(sel)
    			var vid=sel.options[sel.selectedIndex].value;
    			var items="<p>"+vid+"</p><br>";
    			items+="<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\">";
    			items+="<tr><th>Invoice Number</th><th>Invoice Date</th><th>Amount</th></tr>";
    				var nitem="";				
    			<legend>Select Vehicle</legend>
    			<input type='hidden' name='submitted' id='submitted' value='1'/>
    			<label for='serstr' >Vehicle:</label><br>
    			<input type='text' name='serstr' id='serstr'  maxlength="50"/><br>
    			<input onclick="GetVehicles()" type='button' name='Filter' value='Filter'/><br>
    			<label  for='vehicles' >Vehicle:</label><br>
    			<select onchange="GetInvoices(this)" id="a1_vehicle" name="a1_vehicle">
    	<div id="a1_invoice" name="a1_invoice">
    My Php Script definatly works and echos the JSON as expected see here
    but id say its the $.getJSON("phpscripts/getinvoices.php?a="+vid,function(data) bit thats not working as i have played around putting other Html Rows in during that section and they haven't come out

    Many thanks for any help


  2. #2
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004

    Re: Java Script Not Working?

    See my reply to for tips which might help. Also, the web browser development tools are a great help in debugging javascript, allowing you to set breakpoints on the code and see javascript errors in the script console.

    Google Chrome has built-in "Developer Tools" accessible from the settings menu, as does Safari. Firebug has built-in tools and also the great Firebug extension. Opera has the built-in Dragonfly tools similar to Chrome's developer tools.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


Click Here to Expand Forum to Full Width