Julian Coltea
Julian Coltea

Reputation: 3599

Appending Data to a <div> tag with .NET

So i have the following situation in my html file:

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

I have a jQuery function as follows:

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

where url has GET parameters in the form of something like m=2k01&type=EarlyDetection etc.

In my imageProcess.aspx file, I'm using regular expressions to grab a bunch of images from a folder.

However, each of the divs above are going to have different data in them. I know how to decide which images go where, but I don't know how to use c# to say something like #earlyDetectionScoreMetricsPlots.append("image.png"), since I don't want to append the images directly to imagePreview but rather to the sub div within it, and as far as I know, I can't use jQuery within the imageProcess file.

(I think there might be a way to call specific functions within the imageProcess.aspx file corresponding to the different <divs>, but I don't know how to do that with jQuery). Any help would be much appreciated.

Upvotes: 1

Views: 541

Answers (1)

bluevector
bluevector

Reputation: 3493

You either need more complex jQuery or return the actual content you want in #imagePreview from imageProcess.aspx

Upvotes: 1

Related Questions