Jump to content

dollydollar

Members
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

0 Neutral

About dollydollar

  • Rank
    Newbie
  1. Whatever that error was in my php, it seems to have solved the problem. Thank you very much for your help
  2. The original code gave me the following error on the console; SCRIPT438: Object doesn't support property or method 'error' comment_insert.js (26,4)
  3. This is the original Ajax callback that was used but it didn't work; //procced with ajax callback $('.comment-insert-container').css('border' , '1px solid #e1e1e1' ); $.post("/ajax/comment_insert.php" , { task : "comment_insert", userId : _userId, comment : _comment } ) .error( function( ) { console.log( "Error: " ); }) .success( function( data ) { //Success //Task: Insert html into the ul / li comment_insert( JQuery.parseJSON( data )); console.log( "ResponseText: " + data ); } ); ​So do I replace
  4. I'm pretty much just following along with the YouTube tutorial as I just need to get it working for my site, so I understand some of it. I've created the php that goes with the above code. The next step is to create the database in the tutorial, but I can't get that far as I can't get the code to work <?php if( isset( $_POST['task'] ) && $_POST['task'] == 'comment_insert') { $userId = (int)$_POST['userId']; $comment = addcslashes( str_replace( "\n" , "<br>" , $_POST['comment'] ) $std = new stdClass(); $std->comment_id = 24; $std->userId = $userId;
  5. $( document ).ready( function(){ //this will fire once the page has been fully loaded $( '#comment-post-btn' ).click( function(){ comment_post_btn_click(); }); }); function comment_post_btn_click() { //Text within textarea which the person has entered var _comment = $( '#comment-post-text' ).val(); var _userId = $( '#userId' ).val(); var _userName = $('#userName').val(); if( _comment.length > 0 && _userId != null ) { //procced with ajax callback $('.comment-insert-container').css('border' , '1px solid #e1e1e1' ); $.ajax({
×
×
  • Create New...