从另一个视图使用AJAX更改TD值

时间:2018-07-18 07:21:11

标签: jquery html ajax model-view-controller

我有2个视图,一个是生成报告的主要视图,另一个我不想打开它,只是我设计了特定的表以便在主视图中使用AJAX填充这些表,然后打印它,访问每个<td> id并使用ajax更改其值时遇到的问题,当我尝试警告其内容时,出现了一条消息,消息未定义,请问我该怎么做。

My views structure

function FillAndPrint(arrangement) {

    $.ajax({
        type: "Get",
        url: "/Home/Report_Data",
        datatype: "json",
        dataSrc: "",
        contentType: 'application/json; charset=utf-8',
        data: { 'Arrnagement': arrangement },
        success: function (data) {
            //this just for test, the main code will change tds values from JSON file 
            $("#LD_name").html("test"); // LD_name exist on another view
            alert($("#LD_name").val()); // result is Undefined
            },
        error: function (httpRequest, textStatus, errorThrown) {  // detailed error messsage 
            alert("Error: " + textStatus + " " + errorThrown + " " + httpRequest);
        }
    });
    }

如果无法通过这种方式,请告诉我使用哪种方式。

0 个答案:

没有答案