express響應前端ajax請求

後端其實並不須要知道前端發起的請求是否是ajax,後端只須要響應請求便可. 例子: 前端這樣寫: $('button').on('click', function(event) { event.preventDefault(); /* Act on the event */ $.ajax({ url: '/ajax/test', type: 'get', dataType: 'json', suc
相關文章
相關標籤/搜索