{Giúp với} Component Virturemart Và Ajax Trong Joomla 2.5

Thảo luận trong 'Hướng dẫn - Hỏi đáp' bắt đầu bởi dolphin, 25/6/14.

  1. dolphin

    dolphin Mới tham gia

    Bài viết:
    2
    Likes :
    0
    Chào mọi người. Mình có một vấn đề như sau:
    Mình viết một đoạn code ajax như sau:
    HTML:
    <script>
    (function($){
       $(document).ready(function($){
    
       $('#input_seach').keyup(function(){
         var x=$('#input_seach').val();
       
                    $.ajax({ url: 'index.php?option=com_virtuemart&task=category.category&tmpl=component&format=raw',
                     data: {username: x},
                     type: 'post',
                     success: function(output) {
                                 $('#livesearch').html(output);
                              }
                    });
       });
      });
    })(jQuery);
    </script>
    
    Một file category.raw.php trong foder /component/com_virturemart/controllers/ như sau:
    PHP:
    <?php

    defined
    ('_JEXEC') or die('Restricted access');

    jimport('joomla.application.component.controller');
    class 
    VirtueMartControllerCategory extends JController
    {
      public function 
    category()
      {
       echo 
    9090;
      }
    }
    ?>
    File thực hiện là file default.php trong module mình viết như sau:
    PHP:
    <?php // no direct access
    defined'_JEXEC' ) or die( 'Restricted access' );
    $document JFactory::getDocument();
    //add css
    $document->addStyleSheet(JURI::base() . 'modules/mod_sc_seach/css/sc_style.css');

    //add js
    $document->addScript(JURI::base() . 'modules/mod_sc_seach/js/sc_custom.js');
    ?>
    <div>
    <form action="" method="post" id="a_seach" name="form#ajax_seach">
      <input type="text" placeholder="Ajax seach"  id="input_seach">
      <div id="livesearch"></div>
    </form>
    </div>
    Cùng 1 cách viết như trên nhưng khi mình viết vào com_user thì chạy tốt còn com_virtuemart ở trên lại lỗi như sau:
    Error: 500
    You may not be able to visit this page because of:

    1. an out-of-date bookmark/favourite
    2. a search engine that has an out-of-date listing for this site
    3. a mistyped address
    4. you have no access to this page
    5. The requested resource was not found.
    6. An error has occurred while processing your request.
    Mình nghĩ là do url trong ajax của mình có lẽ đã sai
    url:index.php?option=com_virtuemart&task=category.category&tmpl=component&format=raw
    Mong được sự giúp đỡ của mọi người !
    Cảm ơn mọi người đã đọc!
     
  2. Lê Minh Thiện

    Lê Minh Thiện Rất nhiệt tình

    Bài viết:
    195
    Likes :
    57
    đánh dấu để học hỏi về ajax :D
     
  3. dolphin

    dolphin Mới tham gia

    Bài viết:
    2
    Likes :
    0
    có ai biết help mình với
     
comments powered by Disqus
: virtuemart, ajax

Chia sẻ trang này