php - call jquery load on <a > link -
I have a page in php and all pages I & lt; A
tag to link
For example:
& lt ;? For Php ($ i = 1; $ i & lt; = 5; $ ++) {? & Gt; & Lt; A href = "abc.php? Ref = & lt ;? php echo $ i? & Gt;" Click me on the number and? "Php echo $ i? & Gt; & lt; / a & gt; & lt ;? php}? & Gt;
Once we click on the link, jquery The load function should be called, such as
$ ('# div1'). ('Abc.php? Ref = 1'null, function () {});
< / Pre>but I can not change the php loop and
& lt; a
tags ...thanks
Give each anchor a general class and an attribute that recognizes the value of $ i:
Then attach the on-click function to them:
< Pre () ($ ('a.numbered-anchors'). (Function (e) {var i = $ (this) .attr ('anchor-id'); $ ('# div' + i) .load (...);});
Comments
Post a Comment