javascript - Why changing image link invokes controller asynchronously in asp.net mvc -


i'm changing link of image on client side , invokes controller asynchronously.

i don't understand behavior, explain me happening?

why url adding invokes controller default, happens asynchronously.

    <script>         $("#refreshlnk").click(function () {             $("#cap").attr('src', '@url.action("captchaimage")?' + new date().gettime());         });     </script>     <img id="cap" alt="captcha" src="@url.action("captchaimage")" style="" />    <a id="refreshlnk" href="#">refresh</a>     public actionresult captchaimage()    {    } 

this normal , expected behavior. when click button, script changes src attribute of image "/captchaimage?1376967614675". browser tries render image, invokes url. triggers captchaimage method in controller.

there many posts related question, can start one: how url.action work asp.net mvc?. hope helps!


Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -