function SendComment(sender, blogId) { // first do validation var name = $("input#name" + blogId).val(); if (name == "") { $("label#name_error" + blogId).show(); $("input#name" + blogId).focus(); alert(" "); return false; } var main = $("textarea#main" + blogId).val(); main = main.replace(/\n/g, '!br!'); if (main == "") { $("label#main_error" + blogId).show(); $("textarea#main" + blogId).focus(); alert(" "); return false; } var email = $("input#email" + blogId).val(); var uurl = $("input#uurl" + blogId).val(); var blogId = $("input#id" + blogId).val(); var captchaCode = $('#captchacode' + blogId).val(); //then do captca check var string = "captchacode=" + captchaCode; $.ajax({ type: "POST", url: "captchaCheck.asp", data: string, cache: false, success: function() { var commentData = 'name=' + name + '&email=' + email + '&uurl=' + uurl + '&main=' + main + '&id=' + blogId; // and then send the form $.ajax({ type: "GET", url: "commentInsert.asp", data: commentData, cache: false, contentType: "application/x-www-form-urlencoded;charset=ISO-8859-1", success: function(html) { //showCommentMessageBar(blogId, 'box-success-small', '
'); //showCommentMessageBar(blogId, 'box-success-small', '


'); showCommentMessageBar(blogId, 'box-success-small', '
Dine kommentarer er postet!
Klikk her og se dine kommentarer'); return false; }, error: function(xhr, status, error) { showCommentMessageBar(blogId, 'box-error-small', 'an ajax error inserting comment'); RefreshImage('imgCaptcha'); } }); RefreshImage('imgCaptcha'); ClearUserInput(blogId); }, error: function(xhr, ajaxOptions, thrownError) { RefreshImage('imgCaptcha'); showCommentMessageBar(blogId, 'box-error-small', '  Bokstavene er ikke de samme som i bildet  '); return false; } }); }