View Single Post
Share |
  #1 (permalink)  
Old 12-31-2010, 06:09 AM
-10's Avatar
-10 -10 is offline
v7n Mentor
 
Join Date: 12-31-10
Location: London
Posts: 163
iTrader: 0 / 0%
JavaScript function not defined - php/jQuery

Hey all,

Perplexing issue, this one, and quite complex.

Basically I have a page, blogs.php, which makes an ajax call to another page, blog_data.php and outputs a bunch of blog entries to a page.

On each blog entry, it outputs a button similar to the following:

Code:
<input type='button' onclick='deletePost(blogid)'>
Where blogid is the ID number in the database.

In the head of blogs.php, I have embedded the following javascript (this is in a separate .js file to the ajax calls to generate the blog):

Code:
$(document).ready(function() { function deletePost(post) { var deleteyes = confirm("Are you sure?"); if(deleteyes) { loading_show(); $.ajax ({ type: "POST", url: "content/userpage/blog_delete.php", data: "post="+post, success: "loadData(1);", }); } else { } } });
For some reason, when I click my delete button, it does nothing, and firebug is reporting that deletePost is not defined.

Can anyone help?

Last edited by -10; 12-31-2010 at 06:17 AM.
 
Reply With Quote