can't get .on("submit" ... to work
by pizzipie from LinuxQuestions.org on (#6D58K)
I am using a linux machine with Ubuntu 20.04 and Firefox 115.02(64-bit) browser.
Below is the complete code I have: Before you even get to submit a value for "directory" this message appears:
Quote:
which refers to this on line 24: $("input#srcDir").on("submit".function(event) { ... I have been over this a dozen times and can't figure what stupid thig I have done. Please help !!!
Code:<!DOCTYPE html>
<html>
<script type="text/javascript" src="../../jquery/jquery-3.2.0.js"></script>
<body>
<h3>Enter directory from which photos are to be processed.</h3>
<form method="GET" action=##>
<label for="srcDir">Source Directory</label>
<input type="text" id="srcDir" name="srcDir" required="required" value="/home/rick/Desktop/imageSource" /><br>
<input type="submit" value="Submit" />
</form>
<script type="text/javascript" >
$(document).ready(function() {
var dir="";
$("input#srcDir").on("submit".function(event) {
event.preventDefault();
dir=$("input[type=text]").val();
})
$.ajax({
method: "GET",
url: "../chooseDir_v1.1.php",
data: { "dir": dir }
});
})// ready
</script>
</body>
</html>
Below is the complete code I have: Before you even get to submit a value for "directory" this message appears:
Quote:
Uncaught SyntaxError: missing ) after argument list init.php:24:47 |
Code:<!DOCTYPE html>
<html>
<script type="text/javascript" src="../../jquery/jquery-3.2.0.js"></script>
<body>
<h3>Enter directory from which photos are to be processed.</h3>
<form method="GET" action=##>
<label for="srcDir">Source Directory</label>
<input type="text" id="srcDir" name="srcDir" required="required" value="/home/rick/Desktop/imageSource" /><br>
<input type="submit" value="Submit" />
</form>
<script type="text/javascript" >
$(document).ready(function() {
var dir="";
$("input#srcDir").on("submit".function(event) {
event.preventDefault();
dir=$("input[type=text]").val();
})
$.ajax({
method: "GET",
url: "../chooseDir_v1.1.php",
data: { "dir": dir }
});
})// ready
</script>
</body>
</html>