Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2012
    New Hampshire
    Thanked 0 Times in 0 Posts

    TypeError: data.sku is undefined

    Good Morning,
    I am trying to get information that is json_encoded and use that to populate a tablesorter table. I am getting the following error: TypeError: data.sku is undefined. Here is my ajax code:
    // to view and update inventory based on a sku range or a name
    $('#getInfo').live('click', function() {
    	//clear table before search
    		$("#inventoryUpdate tbody tr").remove();
    		type: "POST",
    		url: "getInventory.php",
    		datatype: "json",
    		data: ({skuStart: $("#startSkuRange").val(), skuEnd: $("#endSkuRange").val(), processDate: $("#processDate").val(),
    		       source: $("#source").val()}),
    		success: function(data){
    			 var sku = data.sku
    			/*if(sku == null){
    					$("#inventoryUpdate").append('<tr><td>No Records Found</td></tr>');
    			for(var x=0;x<data.sku.length;x++)
                $("#inventoryUpdate").append('<tr><td id="tableSKU">'+data.sku[x]+'</td><td id="tableISBN">'+data.isbn[x]+
    					 '</td><td><input type="text" id="tableQuantity" value="'+data.quantity[x]+
    					 '"/></td><td><input type="text" id="tableDefect" value="'+data.defect[x]+
    					 '"/></td><td><input type="text" id="tableSource" value="'+data.source[x]+
    					 '"/></td><td><input type="text" id="tableFeature" value="'+data.feature[x]+
    					 '"/></td><td><input type="text  id="tableLocation" value="'+data.location[x]+
    					'"/></td><td><input type="text" id="tableProcessDate" value="'+date.processDate[x]+
    					'"/></td><td><input type="text" id="tableBookType" value="'+data.booktype[x]+
    					'"/></td><td><input type="text" id="tableCreatedBy" value="'+data.created[x]+
    					'"/></td><td><input type="text" id="tableModifiedBy" value="'+data.modified[x]+
    				//} // end of else statement
    		} // end of success function
    	});// end of ajax call
    }); // end of inventory update function
    I know there is information there since it is show when I use Firebug and the console.log(data) line. Here is the data returned:
    Does any one have an idea of what I am doing wrong? I am using the exact same code ( with a different table id) earlier in the page and it is working perfectly.

  2. #2
    New to the CF scene
    Join Date
    Jul 2012
    New Hampshire
    Thanked 0 Times in 0 Posts
    Found the error. Datatype needs to be dataType


Tags for this Thread

Posting Permissions

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