Redscrapbook
asked on
syntax error on line 53
syntax error on line 53.
I'm following a simple ajax>php>mysql example posted here http://openenergymonitor.org/emon/node/107
I've come across syntax error on line 53 and I don't know how to fix this?
I'm following a simple ajax>php>mysql example posted here http://openenergymonitor.org/emon/node/107
I've come across syntax error on line 53 and I don't know how to fix this?
<!---------------------------------------------------------------------------------------------
Example client script for JQUERY:AJAX -> PHP:MYSQL example
by Trystan Lea : openenergymonitor.org : GNU GPL
I recommend going to http://jquery.com/ for the great documentation there about all of this
---------------------------------------------------------------------------------------------->
<html>
<head>
<script language="javascript" type="text/javascript" src="jquery.js"></script>
</head>
<body>
<!---------------------------------------------------------------------------------------------
1) Create some html content that can be accessed by jquery
---------------------------------------------------------------------------------------------->
<h2> Module No2 </h2>
<h3>Output: </h3>
<div id="output">this element will be accessed by jquery and this text will be replaced</div>
<script id="source" language="javascript" type="text/javascript">
$(function ()
{
//-------------------------------------------------------------------------------------------
// 2) Send a http request with AJAX http://api.jquery.com/jQuery.ajax/
//-------------------------------------------------------------------------------------------
$.ajax({
url: 'api.php', //the script to call to get data
data: "", //you can insert url argumnets here to pass to api.php for example "id=5&parent=6"
dataType: 'json', //data format
success: function(rows) //on recieve of reply // change from data to rows
{
for (var i in rows)
{
var row = rows[i];
var id = row[0]; //get id //var id = row[0];
var vname = row[1]; //get name // var vname = row[1];
//--------------------------------------------------------------------------------------
// 3) Update html content
//--------------------------------------------------------------------------------------
// $('#output').html("<b>id: </b>"+id+"<b> name: </b>"+vname); //Set output element html
//recommend reading up on jquery selectors they are awesome http://api.jquery.com/category/selectors/
$('#output').append("<b>id: </b>"+id+"<b> name: </b>"+vname)
.append("<hr />");
}
}
});
</script>
</body>
</html>
It looks like you are missing the closing }); from the $.ajax
Sorry my mistake on line 47. It is good as it is.
Sorry my mistake on line 47. It is good as it is.
ASKER
ok can you replace a missing part? I can't see anything please?
Show it in codes of a missing part.
Show it in codes of a missing part.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That is a fastest response...in ten minutes.
line 28 has ({
line 33 {
line 35 {
line 47 missing )
line 49 }
line 50 }
you are missing a total of one } and two ).