Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
Thread Tools Display Modes
Share |
  #1  
Old 12-31-2010, 07: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 07:17 AM.
 
Reply With Quote

Advertisement

Advertisement

  #2  
Old 12-31-2010, 08:25 AM
webcosmo's Avatar
webcosmo webcosmo is offline
Contributing Member
 
Join Date: 03-17-07
Location: Boston, MA
Posts: 2,071
iTrader: 5 / 100%
posting the url could help.

could you check if you are referencing the jquery.js file; if its missing or not referencing right.
 
Reply With Quote
  #3  
Old 12-31-2010, 08:32 AM
-10's Avatar
-10 -10 is offline
v7n Mentor
 
Join Date: 12-31-10
Location: London
Posts: 163
iTrader: 0 / 0%
I am referencing the jquery.js file, the other javascript file is performing ajax operations against it (this is how it displays the blogs in the first place).

The URL is http://logicalconclusion.net/beacon/...?user=testuser

Username testuser & password testuser (the delete button will only appear if you're logged in as the blog poster).

Last edited by -10; 12-31-2010 at 08:37 AM.
 
Reply With Quote
  #4  
Old 12-31-2010, 11:47 AM
-10's Avatar
-10 -10 is offline
v7n Mentor
 
Join Date: 12-31-10
Location: London
Posts: 163
iTrader: 0 / 0%
Got it fixed, I was loading the functions in document.ready
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Learning jQuery before Javascript? xkw Coding Forum 1 03-27-2010 05:43 PM
Javascript Function Not Working Pope Pius X2 Coding Forum 6 12-19-2008 03:30 PM
JavaScript - Function is undefined (But I defined it, I swear!) pipelineae Coding Forum 1 03-09-2008 07:16 AM
Cannot assign a function to JavaScript event; o_O. stewart Coding Forum 3 11-22-2007 11:07 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 06:23 AM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC