jainish jainish - 6 months ago 57
jQuery Question

Why jquery return [object][object] value?

click on this Link
Problem:When output is Getting that time value in text box is [object][object]

Jquery code:

function EditDirectWarping() {
var dwviewmodel;
dwviewmodel =
{
DirectWarping: {

DispoNo: 12346,



}
}
CallAjax("/Production/Get_DirectWarpingData", "json", JSON.stringify(dwviewmodel), "POST", "application/json", false, DirectWarping_CallBackMethod, "", null);
}


function DirectWarping_CallBackMethod(data) {

$("#txtgrosswt").val($(this).val(data.DirectWarping.Gross_Wt)),

$("#txtnetwt").val($(this).val(data.DirectWarping.Net_Wt)),

$("#txtwarpingmachine").val($(this).val(data.DirectWarping.Warping_Machine)),

$("#txtwarpingmachinespeed").val($(this).val(data.DirectWarping.Warping_Machine_Speed)),

$("#txtprogramcheckedby").val($(this).val(data.DirectWarping.Program_Checked_By)),

$("#txtprogramgivenby").val($(this).val(data.DirectWarping.Program_Given_By)),

$("#txtoperatorremark").val($(this).val(data.DirectWarping.Operators_Remark)),

$("#txtwastage").val($(this).val(data.DirectWarping.Wastage)),

$("#txtjumbobeammtrs").val($(this).val(data.DirectWarping.Jumbo_Beam_Mtrs)),

$("#txtpressurerollpressure").val($(this).val(data.DirectWarping.Pressure_Roll_Pressure))

}


When output is Getting that time value in text box is [object][object]

Answer

When JavaScript prints [object Object], it means you are trying to output an object instead of a string or number.

To display a date object as a string, use:

theDateObject.toString();