hey guys I just implemented some AJAX which calls a PHP function and gets random data from a database, and displays it accordingly.

Problem is, I had the link which you click the randomly change the information on screen counting how many times it'd been clicked with a session. And after implementing the AJAX, it no longer works, I was wondering if you guys new how to get this back working?

I've tried a few things but nothings worked as of now.

Here's the AJAX:

$(document).ready(function(){

	$("#generate-quote").click(function(e){

		e.preventDefault();

		$.getJSON("generator.php?", {act: 'char_con'}, function(data){

			$(".quote").html(data);
		});
                                        

	});
                                
                                
});

And here's the link which is calling both the AJAX and the PHP count function:

<p id="Generate">
<a id="generate-quote" href"index.php?act=bc" class="main_control">
link
</a>
</p>

As you can see I'm trying to use the 'act=' to call on the right function, but it doesn't work with the AJAX involved, anyone know how to get round this?

Thanks for any info

I'd replace getJSON with .post()... but you may need to update the input params.

getJSON breaks when the called script doesn't return a properly formatted JSON object.... so Firebug Addon is your best friend.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.