How to receive data from database via jquery? [wordpress .js]

前端 未结 2 838
悲&欢浪女
悲&欢浪女 2021-01-16 05:56

I am trying to fetch few data from database in my .js file of wordpress theme. I tried with .post() of jquery but nothing is happening.

Please also suggest me any al

2条回答
  •  Happy的楠姐
    2021-01-16 06:41

    You can use the jQuery AJAX get shorthand:

    $.get( "../abc.php", function( data ) {
      alert( "Data Loaded: " + data );
    });
    

    Good to know: Since you're getting data from a file, you should use a GET.

提交回复
热议问题