使用.NET </div>将数据附加到<div>标记

时间:2012-06-13 20:39:16

标签: c# jquery .net html append

所以我的html文件中有以下情况:

<div id = "imagePreview">
    <div id = "earlyDetectionPlots">
        <div id = "earlyDetectionScoreMetricsPlots">
        </div>
        <div id = "earlyDetectionVariableMetricsPlots">
        </div>
        <div id = "earlyDetectionPseudoStandardizedCoefficientPlots">
        </div>
    </div>
</div>

我有一个jQuery函数如下:

        $(document).on('click', 'a[data-link]', function () {
        var $this = $(this);
        url = $this.data('link');
        $("#imagePreview").load("imageProcess.aspx?" + url);
    });

其中url的GET参数形式为m=2k01&type=EarlyDetection等。

在我的imageProcess.aspx文件中,我使用正则表达式从文件夹中抓取一堆图像。

但是,上面的每个div都会有不同的数据。我知道如何决定哪些图片去哪里,但我不知道如何使用c#来说#earlyDetectionScoreMetricsPlots.append("image.png"),之类的内容,因为我不想将图像直接附加到imagePreview而是{{1}在其中的div,据我所知,我不能在sub文件中使用jQuery。

(我认为可能有一种方法可以在imageProcess文件中调用与不同imageProcess.aspx对应的特定函数,但我不知道如何使用jQuery执行此操作。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

您需要更复杂的jQuery或从#imagePreview

返回imageProcess.aspx所需的实际内容