2015-06-05 28 views
0

我在我的應用程序有一些問題,我使用laravel 4.2框架。一切似乎都工作正常,除非我測試了在Safari和手機laravel ajax在Safari和移動方法調用NotFoundHttpException

這是Ajax請求我做

 
function couponAuth(data) 
    { 
     $.ajax({ 
      type: 'POST', 
      url: 'coupon/verify', 
      data: data, 
      success: function(response){ 
       if(response.status === 'fail') 
       { 
        displayError(response.data.coupon[0]); 
       } 
       else{ 
        $(location).attr('href',response.data.url); 
       } 
      }, 
      error: function(response){

 } 
    }); 
} 

這是路線

 
Route::group(array('before' => 'csrf'), function(){ 
    Route::post('/coupon/verify',['uses' => '[email protected]', 'as' => 'coupon-verify']); 
}); 

回答

0

試試這個

function couponAuth(data) 
    { 
     $(document).ready(function(){ 
      $.ajax({ 
       type: 'POST', 
       url: 'coupon/verify', 
       data: data, 
       success: function(response){ 
        if(response.status === 'fail') 
        { 
         displayError(response.data.coupon[0]); 
        } 
        else{ 
         $(location).attr('href',response.data.url); 
        } 
       }, 
       error: function(response){ 
       } 
      }); 
     }); 
    }