In first I excuse with you for my English! I have been studying since 2 years!
I have this problem with my function for loading a messagges quote for my website.
The function could work in this way:
Users click on a link like as
<a class="quote" href="i.quote.php?n=022050" rel="quote_link">Show quote</a>
An ajax function get the text quoted.
Response text replaces
<a class="quote" href="i.quote.php?n=022050" rel="quote_link">Show quote</a>
with
<blockquote class='rounded'>text quote found</blockquote>
All works fine! Problem is when in the response text, there is another link which shows another quotes.So when I click it, function doesn't work and browser load directly the link quote.
This is the function:
$('a[rel=quote_link]').on('click',function(){
linkQuote = $(this).attr('href');
textQuoted = $.ajax({url:linkQuote,type:"GET",async:!1}).responseText;
$(this).replaceWith( "<blockquote class='rounded'>" + textQuoted + "</blockquote>" );
event.preventDefault();
});
I have read on stackoverflow.com
that to use jQuery
.on()
, but function still doesn't work!
Thank you at everyone :).
Sorry for my English and I hope that I understand the rules of posting new question.