Jump to content

Recommended Posts

I have a .js file that is referenced in the page, but when I try and run the functions from it the debugger says that the function is undefined.

 

the HTML to load the js file is

 

<script language="JavaScript" type="text/javascript" src="http://www.starkeracing.co.uk/fullthrottle/library/club.js"></script>

 

 

the call to the function in the HTML

 

<a href="javascript:modifyClub(5);">Modify</a>

and the JavaScript file is

 

function modifyClub(clubId)
{
function code here
}

 

I don't understand why it is saying the function is undefined.

Link to comment
https://forums.phpfreaks.com/topic/285354-functioned-undefined/
Share on other sites

  • 3 weeks later...

Your javascript file has an error in it, right here:

	with (window.document.frmAddProduct) {
		
		} else if (isEmpty(txtName, 'Enter Product name')) {
			return;
		} else {
			submit();
		}
	}
Because of that, the entire file cannot be loaded and none of it's functions will be defined. You need to fix that error then it will define the function.

 

What you are doing is a poor practice also. There is no need to involve Javascript here as all you are doing is linking to another page. Just simply do:

<a href="index.php?view=modify&club=5">Modify</a>
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.