How do you convert this jquery code to plain JavaScript (i.e. Remove jquery dependency)?
Inside the <head> of app.html
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
var textToSend = "blah blah";
var moreText = "yada yada yada";
$.post( "process.php", { text1: textToSend, text2: moreText},
function( data ) {
alert("Process.php script replies : " + data);
}
);
</script>
process.php is in the same folder on the server.
<?php
print "<p>You said " . $_POST['text1'] . "</p>";
print "<p>Then you added " . $_POST['text2'] . "</p>";
?>
Forgive my newbie vagueness.
Thanks in advance.
Try this.
EDIT: I added
encodeURIComponent()function to encode the parameters.