I need to know how to send the form id, which varies according to the post ID, which would be something like myForm '. $ id.' to be able to treat each form itself. The form is sent through the script:
function rpbox(value, valor) {
$(document).ready(function() {
$("#"+value).keydown(function(evt) {
var message = $("#"+value).val();
if (evt.keyCode == 13 && !evt.shiftKey) {
if (message != ''){
if (document.getElementById("reply_box"+valor).style.display == "none") {
document.getElementById("reply_box"+valor).style.display = "table";
document.getElementById("l"+valor).style.display = "none";
}
$("#myForm"+valor).submit();
}
$("textarea").val('');
evt.preventDefault();
return false;
}
});
});
}
This script would be to handle the form I need to handle IDdoform.
$(document).ready(function() {
$("#"+IDdoform).ajaxForm({
target: ".comment_all",
type: "POST",
success: function(){
$(".comment_all").append;
}
});
});
Another issue is that I have a "button" that shows the amount of comments, but when I add it through ajax, the button stays with the previous amount. I have no idea if you have upgrade.
<input class="lsubmit4" type="button" name="'.$post['id_p'].'" value="Comment ('.$rows.')" onclick="openReply(this.name)"/>
$(document).ready(function() {
function rpbox(value, valor) {
$("#"+value).keydown(function(evt) {
var message = $("#"+value).val();
if (evt.keyCode == 13 && !evt.shiftKey) {
if (message != ''){
if (document.getElementById("reply_box"+valor).style.display == "none") {
document.getElementById("reply_box"+valor).style.display = "table";
document.getElementById("l"+valor).style.display = "none";
}
$("#myForm"+valor).trigger("submit", valor);
}
$("textarea").val('');
}
});
}
$(".imagem_news").click(function(){
var id = this.id;
var valor = this.id.match(/\d+/);
rpbox(id, valor);
});
$("form").submit(function(e, i){
var myForm = "myForm"+i;
e.preventDefault();
$("#"+myForm).ajaxForm({
type: 'POST',
url: 'processing.php',
target: '.comment_all',
success: function(){
$(".comment_all").append;
}
});
});
});