I use the hack method to debug AJAX requests. My project is Laravel. You can change this code as compatible with your technology.
Main idea:
- Remove the debug port of the home page
- Create session
- Using this session, concatenate the AJAX URL
When debugging starts, the port will be applied to all ajax urls that have + debug_url .
HomeController @index Method
// Development purpose only if ($request->has('XDEBUG_SESSION_START')) $request->session()->put('debug_port' , $request->get('XDEBUG_SESSION_START'));
master.blade.php
<script> var debug_url='?XDEBUG_SESSION_START={{session('debug_port')}}'; </script>
submit.blade.php
<script> $.ajax(url + debug_url, { method:'post', data:{} }); </script>
source share