Reputation: 1026
Is it possible to change the content of a webpage using ajax?
My need is to actually change the options of a selection.
For example my x123.com/setting.html
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Webpage</title>
<script>
function save_changes() {
//save the selection
}
</script>
</head>
<body>
<select name="" multiple>
<option value="123">123</option>
<option value="456">456</option>
</select>
<input type="button" name="Submit Dude" onclick='save_changes()'>
</body>
</html>
I want to give a request from x123.com/123.html
and reload the current page(x123.com/123.html
) so that the changes in x123.com/setting.html
are actually reflected in this one.
Lemme know if my explanation is not clear.
Upvotes: 0
Views: 1700
Reputation: 43810
You can use ajax this way with jquery
include the jquery script
also the form needs to have a proper format so you can use the serialize() method
<form action="" method="">
<select name="selection" multiple>
<option value="123">123</option>
<option value="456">456</option>
</select>
</form>
Upvotes: 1