ebolt007 Posted March 22, 2012 Share Posted March 22, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/259491-inputs-dont-work-when-inside-url-php-file/ Share on other sites More sharing options...
ebolt007 Posted March 22, 2012 Author Share Posted March 22, 2012 Whoops, this is sposed to be in the Ajax forum, not sure how I got into this one, I could've sworn I clicked Ajax, mods, can you move this? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/259491-inputs-dont-work-when-inside-url-php-file/#findComment-1330191 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.