Take the 2-minute tour ×

So I'm fairly new to the .NET framework, but what I'm trying to do is execute the following jQuery code:

    $(document).on('click', 'a[data-link]', function () {
        var $this = $(this);
        url = $this.data('link');

where url holds something like "model=2k01&type=black&category=variable". Unfortunately this doesn't work, becuase when I do something as simple as a Response.Write() in the aspx file, the div tag imagePreview doesn't do anything. However, removing the ? + url part works, but then I can't send any data over to the aspx file. I'm doing it this way because every link a[data-link] has different data that's being sent over, and I need to find a dynamic way to achieve this. Any suggestions would be much appreciated.

UPDATE: Here is the part in my html code that is generating the url stuff:

<a class='modelsBlue' href = '#' data-link='model=" + $(this).find('model').text() + "&type=" + category + "'>" + $(this).find("model").text() + "</a>

and #image preview is in my code as:

<div id = "imagePreview"></div>

When I try to run the code above, i get the following error which seems to be coming from the jQuery.js file:

Microsoft JScript runtime error: Syntax error, unrecognized expression: &type=AutoEarly

Here is the imageProcess.aspx.cs file, which right now is just outputting all images in the directory:

namespace ModelMonitoring
    public partial class imageProcess : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)
            foreach (var f in Directory.GetFiles(Directory.GetCurrentDirectory()))
                Response.Write("<br />");

SECOND UPDATE: I don't get the error running in chrome or firefox, but the files are not being output.

share|improve this question
The client side is good. –  gdoron Jun 7 '12 at 15:04
works for me. maybe post some more of your code? –  Tim B James Jun 7 '12 at 15:23
In which version of browser your testing the same? –  Deepesh Jun 7 '12 at 15:30
Try ie 9 or google chrome as you are using html 5 and ie 8 doesn't support it –  Deepesh Jun 7 '12 at 15:31
I think that the problem is not on serverside, try debug and look what you are actually passing to jquery load function. Then try replace your load("imageProcess.aspx?"+url) with your actual string and check if it goes to server –  Ihor Deyneka Jun 7 '12 at 15:56
show 3 more comments

1 Answer

up vote 0 down vote accepted

Turns out it was a whitespace issue. I had to add a wrapper around:


to read:


becuase the xml file I was reading from had whitespace around the model name. Thanks to anyone who replied!

share|improve this answer
add comment

Your Answer


