I have written a form using the jQuery .post() function to post the data to a php file. The error I keep getting is "missing : after property id". Any help would be appreciated.
Here is the form code:
<form id="ev-form" name="ev-form" action="/new_event_submit.php" method="post">
<fieldset>
<ol>
<li>
<label for="ev-name">Event</label>
<input type="text" id="ev-name" name="ev-name" class="text" />
</li>
<li>
<label for="ev-date">Date & Time</label>
<input type="text" id="ev-date" name="ev-date" class="text" />
</li>
<li>
<label for="ev-desc">Description</label>
<textarea id="ev-desc" name="ev-desc" cols="" rows="" class="textarea"></textarea>
</li>
<li>
<input type="submit" id="ev-submit" value="Submit Event" class="submit" />
</li>
</ol>
</fieldset>
<div id="load-icon"></div>
</form>
The javascript .post() function is as below:
$j(document).ready(function(){
//Setup on the click event
$j('#ev-form input.submit').click(function(){
//Setup some variable with needed values
var input_name = $j('input:eq(0)').val(),
input_date = $j('input:eq(1)').val(),
input_desc = $j('#ev-form textarea').val(),
ajax_loader = '<img src="ajax-loader.gif" alt="Loader" />';
//Hide and previous response
$j('#response').hide();
//show the loader
$j('#load-icon').html(ajax_loader);
$j.post('new_event_submit.php', {ev-name: input_name, ev-date: input_date, ev-desc: input_desc}, function(data) {
//Hide the loader
$j('#load-icon img').hide(1000, function() {
$j('#ev-form').append('<div id="response">' + data + '</div>');
});
});
return false;
});
});