If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

AJAX on click function not working more than once.

I have an onclick that needs to repeat the function as many times as the user may decide to click. However, for some reason no matter what, if they click it once its only going to return the desired effect once, at which point they'd need to re open the page and click it again.

Since I don't want to post the whole server side process, I have an example..

Here's "TCG.PHP", the page the AJAX communicates with.

Code:

<?PHP echo rand(0,255); ?>

Everytime they click a certain button, it calls the AJAX which calls that page. However, more than one click won't work. Say I push the button, it will return say (39?), and if i click again it just keeps 39 rather than redoing the server side process.

Advertiser Disclosure:
Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.