Jump to content

input's don't work when inside url: ".php" file.


ebolt007

Recommended Posts

Ok, so I have a few ajax pieces on my site, and I am trying to include functionality when something is clicked. Basically, lets say like on facebook, when someone makes a comment, then that new comment is created using something like

 

$.ajax({
type: "POST",
url: "../include/comment_ajax.php",
data: dataString,
cache: false,
success: function(html){
$("#Loadnewcomment"+Id).append(html);
$(".oldcommenthide"+Id).hide(), $(".newcomment"+Id).show();
}
});

 

Now in that comment_ajax.php let's say there is another like or comment input field, something like.

 

<div class=\"Likecomment\">
                                <div id=\"likehide\" class=\"likehide$commentID$CommentIDLike\">
                                    <form method=\"post\" name=\"$commentID$CommentIDLike\" action=\"\">
                                    <input type=\"hidden\" id=\"PostID$commentID$CommentIDLike\" value=\"$PostID\" />
                                    <input type=\"hidden\" id=\"UserPostID$commentID$CommentIDLike\" value=\"$PostUserID\" />
                                    <input type=\"submit\" class=\"likepost\" id=\"$commentID$CommentIDLike\" value=\"Like\" />
                                   </form>
                                   </div>";

 

How would I get this form to also use the ajax that is on the original page, because this is loaded in thru the ajax, so it doesn't know to use the normal ajax. My likes work perfectly, unless I create a new comment, then on that new comment, if I click "Like" on a comment, rather than it just changing, it reloads the page, then I can click like on it like normal and it changes using my ajax, but not until the page is reloaded.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.