tatty27
tatty27

Reputation: 1554

How to use an anchor tag with jQuery

I have a slider script that can link to other tabs in the slider using anchor tags

The html

<a class="st_ext" href="#tab_<? echo $next_tab; ?>"
     rel="st_horizontal<? echo $audit_id; ?>">tab link</a>

This will move to the slider to the next tab. It works if I wrap it around the submit button but then the ajax query doesn't work).

Question is, how would I put this into a jquery success response? I would like it f the user can click on the button that triggers the ajax call and if it is successful it opens the next tab on the slider using the above method.

The jQuery ajax

type: "POST",
url: "ajax/image_audit.php",
dataType: "json",
data: $('#audit_form'+form_id).serialize()+'&standard_used='+standard_in_sight,
    success: function(response){
         ------> call to anchor tag here
}

Alertnatively, if I can't do this is there a way that I can add the tag to the button so that the jquery is called first before the tag?

The button..

    <input type="button" 
 name="audit_submit" class="audit_submit audit_submit_btn ie7_submit" value="" />

The ajax is called using the audit_submit class as the trigger

Upvotes: 0

Views: 924

Answers (1)

Ramesh Kotha
Ramesh Kotha

Reputation: 8322

Try this $(".st_ext").click(); if you have many elements styled with st_ext add id to the anchor element and call something like below

<a id="click_me" class="st_ext" href="#tab_<? echo $next_tab; ?>"
     rel="st_horizontal<? echo $audit_id; ?>">tab link</a>

$("#click_me").click();

hope it helps.

Upvotes: 1

Related Questions