javascript - Is this a browser cache problem? -
can check if browser cache problem?
i have scenario, have table displays data , below link sends url. 1 row can click @ time.
<table> <thead> . . </thead> <tbody> <tr> <td><input type=""checkbox" value="1" name="_chk"/></td> <td>field1</td> <td>field2</td> </tr> </tbody> </table> <a href="/myapp/url.htm" id="mylink">change</a>
on click of link, adding current click id href attribute using jquery
$(document).ready(function(){ $("#mylink").click(function(){ var transid = $("input[name='_chk']:checked").val(); var currhref = $(this).attr("href"); $(this).attr("href", currhref + "?transid=" +transid); }); });
on first click, ok , transaction id gets appended parameter new url string /myapp/url.htm?transid=1?
problem this, when click button , click row, url parameter string gets doubled /myapp/url.htm?transid=1?transid=2
is browser cache problem , there workaround this?
try this...
$(document).ready(function() { var baseurl = "/myapp/url.htm"; $("#mylink").click(function(){ var transid = $("input[name='_chk']:checked").val(); $(this).attr("href", baseurl + "?transid=" +transid); }); });
Comments
Post a Comment