Jump to content

Recommended Posts

Here is my java script

$.each(data, function() {
						var myTable1 =
       						'<tr bgcolor=#ffffff>' +
								'<td align=center>'+this.vehiclelog_plate+'</td>' +
								'<td align=center>'+this.vehiclelog_name+'</td>' +
								'<td align=center>'+this.vehiclelog_date+'</td>' +
								'<td align=center>'+this.vehiclelog_reftype+'</td>' +
				    			'<td align=center>'+this.vehiclelog_refid+'</td>' +
								'<td align=center>'+this.vehiclelog_description+'</td>' +
							'</tr>';
						
						 $('#tableField').append(myTable1); 
				});

And here is my HTML

<div id="tabs-6">
		<div id="rform">
			<form action = "home.php" method="post">
				<fieldset>
                    <legend>View Vehicle Service</legend><br><br>					
					<div>
						<label class="label-left">Vehicle Name:</label>
						<span role="status" aria-live="polite" class="ui-helper-hidden-accessible"></span>
						<input id="autocomplete" title="type "a"" class="ui-autocomplete-input" name="vehicle_service_search" autocomplete="off">
                    </div>
					<div>
						<button id="searchVehicleDesc" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">
							<span class="ui-button-text">View</span>
						</button>  
					</div>
					<div>
					<table border="1" width="650" id = "tableField"> 
						<tr bgcolor=#c0c0c0>
								<td width=100 align="center"><font face="helvetica"><b>Vehicle Name</b></font></td>
								<td width=80 align="center"><font face="helvetica"><b>Service Type</b></font></td>
								<td width=80 align="center"><font face="helvetica"><b>Others</b></font></td>
								<td width=100 align="center"><font face="helvetica"><b>Reference No.</b></font></td>
				    			<td width=80 align="center"><font face="helvetica"><b>Reference Date</b></font></td>
								<td width=80 align="center"><font face="helvetica"><b>Reference Type</b></font></td>
							</tr>
					</table>
					</div>
				</fieldset>
            </form>
		</div>
	</div>

And here is my response

[{"success":1,"plate":"SIX666","name":"YAMAHA ISUZU","date":"0000-00-00","type":"Add Vehicle","id":"0","desc":""},{"success":1,"plate":"VIE597","name":"Resource id #6","date":"2014-05-09","type":"OIL","id":"332142","desc":"castroil"}]

Im getting the right response from ajax but I can't put my value to a table I get an alert that says undefined.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.