2017-05-30 4 views
-1

Das Einfügen von Daten mit funktioniert auf XAMpp-Server, aber es funktioniert nicht auf dem Server. Ich habe viele Dinge ausprobiert, bitte helfen Sie mirAjax und jQuery Funktioniert nicht auf Server

dies ist der JavaScript-Code

<script> 
    $(document).ready(function() 
    { 
     //Handler for .ready() called. 
     $("#li_daily_operations").addClass("active"); 
     $("#li_add_daily_log").addClass("active"); 
     $('#save_btn').click(function() { 
    autoSavedata() ; 
}); 

function autoSavedata() 
    {   

     var daily_log = CKEDITOR.instances['daily_log'].getData();// $('textarea.daily_log').val(); 
     var location = $('#location').val(); 
     var user_id = $('#user_id').val(); 
     var post_id = $('#post_id').val(); 
     if(daily_log!= '') 
     { 
      $.ajax({ 
       url:"../php/add/add_daily_log.php", 
       method:"POST", 
       data:{ daily_log:daily_log, location:location, user_id:user_id, post_id:post_id},      
       success:function(data) 
       {   
         if(data!='') 
         { 
          $('#post_id').val(data); 
         } 
         $('#autoSave').text("Data Saved"); 
         setInterval(function(){ 
          $('#autoSave').text(''); 
         }, 3000); 
       } 
      }); 
     }    
    } 
    setInterval(function(){ 
     autoSavedata(); 
     }, 2000); 
    }); 
</script> 

Dies ist der PHP-Code ist, Daten zu speichern, funktioniert dieser Code, wenn sie lokal ausgeführt werden, aber wenn ich diesen o-Server setzen tut es funktioniert

<?php 
    //Include Database Connection 
include '../../dbconnect/dbconnect.php'; 
if(isset($_POST["daily_log"])) 
{ 
    $daily_log = $_POST["daily_log"]; 
    $location = $_POST["location"]; 
    $user_id = $_POST["user_id"]; 
    if($_POST["post_id"] != '') 
    { 
    //update post 
    $sql = "UPDATE daily_log SET daily_log = '".$daily_log."' WHERE daily_log_id = '".$_POST["post_id"]."'"; 
    mysqli_query($conn, $sql); 
    echo $_POST["post_id"];   
    } 
    else 
    { 
    //insert post 
    $sql = "INSERT INTO daily_log(daily_log, data_entered_by, location, post_status) VALUES ('".$daily_log."', '".$user_id."', '".$location."', 'draft')"; 
    mysqli_query($conn, $sql); 
    echo mysqli_insert_id($conn); 
    } 
} 
?> 
+2

Kein Code, keine Erklärung, was Sie versucht haben, keine eingehende Erklärung des Problems .. wir sind jetzt hilfloser als Sie – urbz

+0

Ich habe den Code jetzt hinzugefügt –

+0

Welchen Fehler bekommen Sie? Sie müssen mehr Einblicke teilen, damit wir Ihr Problem verstehen. –

Antwort

0

Download jQuery Ihre root/js Ordner ex: /js/jquery.min.js dann den Code ändern:

<script src="/js/jquery.min.js"></script> 
<script src="/avesi/jquery.paulund_modal_box.js"></script> 
+0

das funktioniert nicht –

Verwandte Themen