$.Ajax problem

Discussion in 'jQuery' started by motor992, Oct 31, 2011.

  1. #1
    Hi !

    I have problem with $.ajax.

    Console show me error : rate.php not found , but if i click on link it works.

    I use Xampp on local host.
    My script :


    
    <script>
    
    function rateThis(value,id,type) {
       
    
    $.ajax({
    
    
    
            type: 'GET',
    
    data : {value : value,movie: id,type : type},
    
            url: '/rate.php',
    
    
    
            success: function(data){
    
    alert('ok');
              
    
    
    
            }
    
    
    
        });
       
       
    }
    
    
    
    </script>
    
    
    
    Code (markup):
     
    motor992, Oct 31, 2011 IP
  2. khu84

    khu84 Active Member

    Messages:
    441
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Have you checked your root path of xampp installation. It may be setup to some sub folder.

    Also try giving the relative path by using ./ or ../ if rate.php is in upper folder in hierarchy, not the path which starts from slash.

    BTW, for server side scripts, paths starting with root path (starts with slash /) are the worst. For html / css it may be ok.
     
    khu84, Nov 1, 2011 IP
  3. dixcoder

    dixcoder Member

    Messages:
    71
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    26
    #3
    dixcoder, Nov 7, 2011 IP
  4. Ovidiu20

    Ovidiu20 Active Member

    Messages:
    44
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    63
    #4
    try using this as url

    url: 'rate.php',

    or try with full path
     
    Ovidiu20, Nov 7, 2011 IP
  5. avinash gaud

    avinash gaud Member

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    2
    Trophy Points:
    26
    #5
    May be your file does not exists or your given path is wrong.
    if your rate.php is in same folder as the ajax file try using
    url: 'rate.php',
     
    avinash gaud, Nov 10, 2011 IP