I've studied and tried to implement the Second answer in this post: Ajax tutorial for post and get
Unfortunately, running the $.ajax script inside a function kicked off by an "onclick" only shows the alert, no other change in the display. Is there a better way to perform that $.ajax process?
Here is my "given" html (referenced within my "subject" html):
<!DOCTYPE html>
<html>
<body>
<p>Cjax at your service</p>
<br><p>"Hello World!"</p>
</body>
</html>
And here is my "subject" (calling) html:
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
function ajaxAppend() {
alert('ajaxAppend Function called');
var myusername = $("#username").val();
$.ajax({
type: "GET",
url: "Cjax01.html",
data: "username=" + myusername,
cache: false,
success: function(data){
$("#resultarea").text(data);
}
});
}
</script>
<p>PHP, not ASP can output plain text:</p>
<input type="text" name="username" id="username">
<div id="resultarea"></div>
<br>
<input type="text" name="results" id="results" value="Duck"><br>
<button onclick="ajaxAppend()">Try it</button>
</body>
</html>
Appreciations in advance...