I have the following code below and I am trying to improve it. How can I know if there is any limitations/drawbacks writing this way and why? Any possible error conditions?
What can be improved on this code? Thoughts? Suggestions?
<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js></script>
<script language="javascript">
$(document).ready(function() {
$("#submit").click(function (event) { // wire up this as an onclick event to the submit button.
var searchTerm = $("#search").val(); // get the user-entered search term
var URL = "http://api.flickr.com/services/feeds/photos_public.gne";
var ID = "25053835@N03";
var tags="&tags="+ searchTerm;
var tagmode="&tagmode=any";
var jsonFormat = "&format=json&jsoncallback=?";
var ajaxURL= URL+"?id="+ID+tags+tagmode+jsonFormat;
$.getJSON(ajaxURL,function(data){
$("h1").text(data.title);
$.each(data.items, function(i,photo) {
var photoHTML = "<h4>" +photo.tags + "</h4>";
photoHTML += '<a href="' + photo.link + '">';
photoHTML += '<img src="' + photo.media.m + '"></a>';
$('#photos').append(photoHTML).fadeIn(2000);
});
});
});
});
//table cell selection
$(document).ready(function(){
var getval = function(html) {
alert(html);
}
$('#tblMain td').on('click', function(){
getval($(this).html());
});
});
</script>
</head>
<body>
<div align="center">
<h2>flicker tag search</h2>
<div>Enter Search Term</div>
<input type="text" id=search />
<input type="button" id=submit value="Search" />
<div id="photos"></div>
</body>
</html>