Simple Javascript routine - and I still can't get it
Posted: Sun May 06, 2012 7:32 am
I thought this would be fairly straight-forward, but something is off.
I've got a page functioning in which users can upload an email address file and insert contents into the database. The returned data displays very nicely into a table block. Now, I want to give users the ability to simply add additional contacts to their "address book" one at a time. I thought it would be a fairly straight-forward task of building inputs and using a submit input to trigger a javascript function. But, I can't even get the submit input to pick up the javascript. Following is my applicable script.
input - type submit
Javascript
Here is the problem - when I click the submit button the following message appears:
that the javascript won't trigger when I click the following?
Thanks Much:
Pavilion
I've got a page functioning in which users can upload an email address file and insert contents into the database. The returned data displays very nicely into a table block. Now, I want to give users the ability to simply add additional contacts to their "address book" one at a time. I thought it would be a fairly straight-forward task of building inputs and using a submit input to trigger a javascript function. But, I can't even get the submit input to pick up the javascript. Following is my applicable script.
input - type submit
Code: Select all
<input type="submit" id ='submit_address' name='new_addrss'value='Submit New Address'>Code: Select all
<script>
/* Define variables. These variables will passed in an array for INSERT into time tables. */
var l_name = trim($_POST['lname']);
var f_name = trim($_POST['fname']);
var e_mail = trim($_POST['email']);
var dphone = trim($_POST['d_phone']);
var p_ext = trim($_POST['ext']);
var cphone = trim($_POST['cell']);
var j_title = trim($_POST['title']);
var record_date = "<?=$firstcontact?>";
var assign_to = "<?=$userid?>";
// document.ready function will not allow any functions to execute unless the page is fully loaded.
$(document).ready(function() {
$(function () {
pass_array = [];
pass_array.push(l_name, f_name, e_mail, dphone, p_ext, cphone, j_title, record_date, assign_to);
$('#submit_address').click(function() {
$.post('test.php', {bind_array:pass_array}, function(data) {
alert(data);
});
});
});
});
</script>Needed information is as follows:File not found. Make sure you specified the correct path.
- The file test.php does exist and the path is correct
- I get this error message even if I remove EVERY LINE of javascript.
It is acting as though the submit click never even triggers the Javascript.
Code: Select all
$('#submit_address').click(function()Code: Select all
<input type="submit" id ='submit_address' name='new_addrss'value='Submit New Address'>Pavilion