在PartialView中更改<p>的值

时间:2017-11-25 18:42:55

标签: javascript jquery

我有 <p id="findings-date" class="blue-text">Test</p>

的PartialView

这是代码

 $(document).on('click',
    '.findingval',
    function () {
        var findingval = $(this).text();
        var idvalue = $(this).siblings('.idvalue').text();
       $('#left-window').load('@Url.Action("Findings", "PatientDatabase")');

    });

我通过这个js代码

将partialView加载到div中
p

我需要将findingval的值更改为$('#findings-date').text(findingval);

我试过

$('#findings-date').text();但它不起作用。

在此之后,我试图获得像 $(document).on('click', '.findingval', function () { var findingval = $(this).text(); var idvalue = $(this).siblings('.idvalue').text(); $('#left-window').load('@Url.Action("Findings", "PatientDatabase")'); var date = $('#findings-date').text(); alert(date); });

这样的价值

但它是空的。为什么这样?

似乎在未附加partialView时尝试获取数据。

完整的脚本代码

long dataToRead;
int length;
byte[] buffer = new Byte[100000];
FileStream iStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);

dataToRead = iStream.Length;
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + file);
while (dataToRead > 0)
{
    // Verify that the client is connected.
    if (Response.IsClientConnected)
    {
        // Read the data in buffer.
        length = iStream.Read(buffer, 0, 10000);

        // Write the data to the current output stream.
        await Response.OutputStream.WriteAsync(buffer, 0, length);

        // Flush the data to the HTML output.
       Response.Flush();

        buffer = new Byte[100000];
        dataToRead = dataToRead - length;
    }
    else
    {
        dataToRead = -1;
    }
}

0 个答案:

没有答案