-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPUT_via_AJAX.html
42 lines (39 loc) · 1.15 KB
/
PUT_via_AJAX.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>PUT via ajax</title>
<script>
$(window).load( function() {
$('form[method=PUT]').submit( function() {
var form = $(this);
var action = form.attr('action'),
method = form.attr('method'),
serializedData = form.serialize();
$.ajax( {
type : method,
url : action,
data : serializedData,
crossDomain : 'true'
});
return false;
});
});
</script>
</head>
<body>
<form action="http://nheise.net/testModule/x/update1" method="PUT">
<input type="text" name="foo1" value="hallo1">
<input type="submit" value="Submit"/>
</form>
<form action="http://nheise.net/testModule/x/update2" method="POST">
<input type="text" name="foo2" value="hallo2">
<input type="submit" value="Submit"/>
</form>
<form action="http://nheise.net/testModule/x/update3" method="PUT">
<input type="text" name="foo3" value="hallo3">
<input type="submit" value="Submit"/>
</form>
</body>
</html>