This is what i was doing with mootools... and it worked flawless in FF and Safari but not in IE after a week of trying to make it work I saw my friend using jquery and I liked it. So i switched to jquery to do my next project and now I need some help... to start understanding more jquery FORM:
<form id="newComment" action="<?=$webUrl?>/add.php" method="post" onSubmit="Comment.submit(); return false;"> <input type="hidden" name="comment_postid" value="<?=$rowPost[post_id]?>" /> <input type="hidden" name="type" id="type" value="1" /> <input name="author" type="text" class="texto" id="author" size="30" /> Mensaje:<br /> <textarea name="content" cols="40" rows="8" class="texto" id="content"></textarea><br /> <input type="submit" class="boton" value="Agregar Comentario →" /> </form> JAVASCRIPT: var commenting = 0; var cmsComment = new Class({ submit: function(){ if ($('author').value === "") { alert("Ingresa tu nick"); return false; } if ($('content').value === "") { alert("Ingresa tu comentario."); return false; } commenting++; $('posting').setHTML('<span class="comloading">Posting...</span>'); new Ajax('add.php',{ data: $('newComment').toQueryString(), onComplete: function(responseText){ $('comments').setHTML('<div id="comment'+commenting+'"></div>' + $ ('comments').innerHTML); $('comment'+commenting).setOpacity(0).setHTML(responseText); new Fx.Style('comment'+commenting, 'opacity').start(0,1); $('posting').setHTML(); } }).request(); $('newComment').reset(); }, delete: function(id){ new Ajax('delete.php',{ data: 'id='+id }).request(); new Fx.Style('comment_'+id, 'opacity',{ onComplete: function(){ $('comment_'+id).setStyle('display', 'none'); } }).start(1,0); } }); var Comment = new cmsComment(); THEN ADD.PHP <?php require_once('config.php'); function fix($string, $mode = 'form') { if (get_magic_quotes_gpc() == 1) { return $string; } else { return mysql_real_escape_string($string); } } $comment_time = time(); mysql_query("insert into `flogComments` set `comment_postid` = '".fix($_POST['comment_postid'])."', `comment_id` = '', `comment_type` = '".$_POST['type']."', `comment_date` = '$comment_time', `comment_user` = '".fix($_POST['author'])."', `comment_text` = '".fix($_POST['content'])."'"); // `email` = '".fix($_POST['email'])."', ?> <strong>Username</strong>: <?php echo stripslashes($_POST['author']); ?><br /> <strong>Conmment:</strong>: <?php echo stripslashes(strip_tags($_POST['content'])); ?><br /> <br /> THEN DELETE.php <?php require_once('config.php'); require_once('access.php'); if(session_is_registered(user_name)){ mysql_query("DELETE FROM flogComments WHERE comment_id = '". $_POST['id']."'"); } ?> The implementations: add would be added as I clicked submit and show in real time in the site delete was called like this. <div id="comment_<?php echo $comment->comment_id; ?>"><hr /><?php if ($userName == $_SESSION[user_name]){?> <a href="javascript:void(0)" onClick="Comment.delete('<?php echo $comment->comment_id; ?>')" style="float: right">delete</a><?php } ?><? php echo "<strong>(</strong>".$i."<strong>)</strong> ".$comment- >comment_user; ?> @ <?=date("d/m/Y H:i:s", $comment->comment_date)? ><br /><?php echo strip_tags($comment->comment_text); ?><br /></div> when I clicked delete it would be delete instantly with no reload and it would dissapear with the fx style found in mootools. so with that in mind im switching to jquery since I didnt like mootols that much... but I want some help getting to somewhere close to what I was doing, I know there are lots of docs and stuff but I need to learn to implement them too, so I look at the functions on jquery and with no examples I get confused and frustrated... so please give me some help. thanks On Sep 24, 5:42 am, MorningZ <[EMAIL PROTECTED]> wrote: > I'm not sure you want/need to start looking at Plugins right away for > such an easy task > > My suggestion is to head over to the docs (http://docs.jquery.com), > pull up the "Ajax" section and take a load at the $.ajax and $.load > methods to start with