How to run multiple ajax calls on one page

前端 未结 3 1803
暗喜
暗喜 2021-01-22 22:01

If I\'m making an \'ajaxified\' user interface with many ajax calls for creating, renaming, deleting various things on my page - what is the best way to handle all those \"code

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-22 23:02

    Sure, what you are doing now is a much better aproach. Just have one file that controlls all actions. I usually use a switch statement on command to keep everything nice and clean.

    switch($_GET[command) 
    { 
      case 'insert' : do insert stuff; break;
      case 'delete' : do delete stuff; break;
    }
    

提交回复
热议问题