Patrioticcow
Patrioticcow

Reputation: 27048

php and jquery, how to do an ajax call using 2 forms?

i am using this example to create a comment system. So far works great.

What i want to do is to add one more form that will insert comments in the database exactly like in that example just use another commentajax.phpwitch ill rename to commentajax1.php in where ill use a different sql statement.

i see the jquery POST $(".submit").click(function() {...} works when a doom element with class="submit" is activated. Will it be enough to create another jquery that is called by another class?

thanks,

Upvotes: 1

Views: 69

Answers (1)

shernshiou
shernshiou

Reputation: 518

Look at this part:

$.ajax({
type: "POST",
url: "commentajax.php",
data: dataString,
cache: false,
success: function(html){
$("ol#update").append(html);
$("ol#update li:last").fadeIn("slow");
$("#flash").hide();
}
});
}return false;
});

It do AJAX to "commentajax.php".

If you create another click event that invoke different AJAX call to different url you will be fine.

Upvotes: 1

Related Questions