Hi guys ive got the following code
Code:
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("form").submit(function() {
$.ajax({
type: "GET",
url: "release.php",
data: "name=Caspa&Rusko",
dataType: "xml",
success: function(xml) {
$(xml).find('release-list').each(function() {
$("span").text($(this).find("title").text()).show();
});
}
});
});
});
</script>
</head>
<body>
<p>Type 'correct' to validate.</p>
<form action="javascript:alert('success!');">
<div>
<input type="text" id="title" />
<input type="submit" />
</div>
</form>
<span></span>
</body>
</html>
Id like to perform the following script but without
Code:
<form action="javascript:alert('success!');">
So I thought id need to be everything in a function then call it with
Code:
<form action="javascript:functionName();">
Id also like to take the paramaters from <input type="text" id="title" /> and put the in data: "name=Caspa&Rusko", something like
Code:
data: "name= + name"
where would I set var name = $("search").val();
Finally if anyone could tell me where the AJAX magic goes so I can have a little loading spinner, that would amazing. Thanks