Click here to Skip to main content
15,911,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
$("cApplication'.$col1.'").click(function(){
				$.ajax({
					url: "?page=acp_apps_check",
					type: "post",
					data: {capp:'.$col1.'},
					success: function(){
						alert("set session");
					}
				});
			)};


The following Ajax code leaves this error for no reason:
Uncaught RefernceError: $ is not defined


Can't understand the problem.

Full PHP code:
PHP
echo '<head><script src="jquery.js"></script>
			<script type="text/javascript">
			$("cApplication'.$col1.'").click(function(){
				$.ajax({
					url: "?page=acp_apps_check",
					type: "post",
					data: {capp:'.$col1.'},
					success: function(){
						alert("set session");
					}
				});
			});
			</script>
			</html></head>';
Posted
Updated 9-May-13 8:38am
v2
Comments
ZurdoDev 9-May-13 14:39pm    
Do you really mean to send the string value ".$col1."? Also, the last combination of squiggs and parens is wrong. It should be just like the closing of the .ajax function }); Just follow their order.
NextGenDeveloper 9-May-13 14:43pm    
Yes I do, I'm doing something that runs on a loop so I need it to work this way.

Also I updated the error, I posted the wrong one. I know that they were not in the right order.
ZurdoDev 9-May-13 14:44pm    
$ is not defined means the browser does not know what $ is. You need to load jquery.js.
NextGenDeveloper 9-May-13 14:48pm    
Thanks! all of the errors are gone, kinda forgot that there is a jquery.js that you need to download and put.
ZurdoDev 9-May-13 15:08pm    
Glad to hear.

1 solution

$ is not defined means the browser does not know what $ is. You need to load jquery.js.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900