Ok basically my problem is what i stated in the title. I'm using jquery tabs and after i submit 1 form and i go about adding another news post instead of doing the ajax submit it just posts to the page.
<script type="text/javascript">
//if submit button is clicked
$('#submit').live("click",function () {
//Get the data from all the fields
var title = $('input[name=title]').val();
var newspost = tinyMCE.get('newspost').getContent();
var type = $('input[name=type]').val();
//Simple validation to make sure user entered something
//If error found, add hightlight class to the text field
//organize the data properly
var data = 'title=' + title + '&post=' + newspost + '&id=' + type;
//start the ajax
$.ajax({
//this is the php file that processes the data and send mail
url: "pages/news.php",
//GET method is used
type: "POST",
//pass the data
data: data,
//Do not cache the page
cache: false,
//success
success: function() {
$('#news_form').html("<div id='message'></div>");
$('#message').html("<h2>News Article has been Submitted!</h2>")
.append("<p>Now visable on main page</p>")
.hide()
.fadeIn(1500, function() {
$('#message').append("<img id='checkmark' src='images/check.png' />");
});
}
});
//cancel the submit button default behaviours
return false;
});
</script>
<div id="news_form">
<form id="form1" name="form1" method="post" action="">
<p>Title:
<label>
<input name="title" type="text" id="title" size="40" />
</label>
</p>
<p>
<label>
<textarea name="newspost" id="newspost" cols="45" rows="5"></textarea>
</label>
</p>
<p><input type="hidden" name="type" value="postadd" />
<label>
<input type="submit" value="Submit" id="submit">
</label>
</p>
</form>
</div>