I have below code in processor.php to view a image from database on the same page using jQuery ajax method. downloading image part is done on another PHP called solve.php. Image is not shown on same page and firebug errors are;
<head>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
$(document).ready( function() {
$(".image-view").click(function(e) {
e.preventDefault();
var url = $(this).attr('href'); // Get href attribute of current element
$.ajax({
url: url, // Use url with arguments
type: "GET",
success: function(data){ //function to be called if request succeeds
$("#preview").html(data); // It should be html here
}
});
}) //line 20
});
</script>
screenshot
What is a cause?
SyntaxError: missing } after function body processor.php (line 20, col 5)
SyntaxError: missing } after function body processor.php (line 20, col 5)
SyntaxError: expected expression, got '}' processor.php (line 21, col 2)