Я бы порекомендовал использовать фреймворк, такой как jQuery. С jQuery вы бы просто:
$("#website_submission_form").submit(function() {
$("#website_submission_form .ajax-loader-animation").show(); // Show the user something is going on...
// You could get an animation here: http://www.ajaxload.info/
$.ajax({
type: "GET",
url: $("#website_submission_website_input_field").attr('value'), // Warning: No parsing/validation of entered value has happened so far!
data: null,
success: function(data, textStatus) {
parseWebsiteForImgTags(data); // data contains the website html source
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert('Something went wrong: ' + textStatus);
$("#website_submission_form .ajax-loader-animation").hide();
}
});
return false;
});