2012-05-01 58 views
1

我使用Silex框架工作,我試圖刪除使用下面的代碼在表中列出的後端文件,但火蟲給了我一個錯誤消息「無效的正則表達式標誌a」而當我點擊它會刪除鏈接白色PAGE電泳代碼上是:無效的正則表達式標誌a

<script type="text/javascript"> 
    $(document).ready(function(){ 
     $(".delete-file").live('click', function() { 
      itemRow = $(this).parent().parent().parent(); 
      fileId = $(this).attr('file_id'); 
      deleteURL = $(this).attr('href'); 

      var html = "<div> Are you sure, you want to DELETE this file? </div>"; 
      var dialog = $(html).dialog({ 
       buttons: { 
        "Ok": function() { 
         $.ajax({ 
          url  : deleteURL, 
          type : 'DELETE', 
          success : function(data) { 
           itemRow.remove(); 
           dialog.dialog("close"); 
          }, 
          error : function() { 
           dialog.dialog("close"); 
          } 
         }); 
        }, 
        "Cancel": function() { 
         $(this).dialog("close"); 
        } 
       } 
      }); 
      return false; 
     }); 
    }); 
</script> 

我用:

{% for row in result %} 
     <tr class="content {{ cycle(['odd', 'even'], loop.index) }}"> 
      <td> {{ row.name }} </td> 
      <td> {{ row.user.username }} </td> 
      <td class="url"> <a href="{{ path('info', {"id" : row.file_id}) }}">{{ row.path | truncate(30) }}</a> </td> 
      <td> <img src="{{conf('base_url')}}/{{row.thumbnail}}"/> </td> 
      <td class="url"> {{ row.size | bytes_format}} </td> 
      <td> {{ row.description }} </td> 
      <td> 
       <span><a href="{{ path('delete', {'id' : row.file_id}) }}" class="delete-file" file-id="{{row.file_id}}">DELETE</a></span> 
      </td> 
     </tr> 
    {% endfor %} 
+0

無效的正則表達式標誌一個 [打破這個錯誤] \t /home/saeed/www/karina/moshare/web/scripts/jquery-1.6.2.min.js ... jquery.min。 JS(第1行,第6欄) – osyan

+0

火的Bug也表明我這個錯誤: $沒有定義 [打破這個錯誤] \t $(文件)。就緒(函數(){ – osyan

+0

哪裏是正則表達式?這是一個JS正則表達式:/ [az] \ w +/gi。最後gi是標誌,g =全局,i =忽略大小寫,表示在某處有'a'。 –

回答

0

我發現了它。這只是因爲給我的.js文件提供了錯誤的路徑!

相關問題