Jump to content

Java script ignoring a button


Shadowing

Recommended Posts

For some reason when I use ajax to place a button on a page. I cant get another java/ajax script to read that the button was pushed. Anyone have any obvious idea as to why? When i hit the button the screen refreshes so thats how i know the javascript isnt reading the button. I can read a input form that is placed on the page just not a button.

 

both scripts are like this one below.  one for putting the button on the page and a simliar one for clicking on the button.

 

$(document).ready(function() {        

$("#update_announcements").click(function(event) {          
	event.preventDefault();
	$.ajax({            

		url: "/System_Lords/ajax/announcements.php?functions=announcements_box",            

		type: 'POST',            

		dataType: 'json',            

		data: { 

			announcements: '<?php echo $announcements; ?>'         

			},            

			success: function(response) {              

				$('#announcements_box').html(response.announcements_box);
				$('#announcements_button2').html(response.announcements_button);

				}        

				});        

				});      

				});  

 

 

Link to comment
Share on other sites

Im starting to some what understand firebug now.

 

been sitting here trying alot of things and for some reason my java script still ignores this button.

 

whats crazy is i read the link you gave me and they talk about using "on" but yet i cant find a reference to "on" in any tutor sites i go too. Then someon told me to try using "live" there is only one change_announcements id on the page also.

 

also i tried $("input#change_announcements") the button is type"submit"

<input type='submit' name='change_announcements' id='change_announcements' value='Update2'>

 

	$("#change_announcements").live("click",function(){         
	event.preventDefault();
	$.ajax({ 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.