当前位置: 动力学知识库 > 问答 > 编程问答 >

php - how to call a Rest Module of Zend framework from another module using ajax

问题描述:

I have a tournament module which is REST.

I can call it using http://localhost:8888/tournament. Now what I wants to do is,

I am having another module that uses this API.

The another module is tournament module,on load I am fetching the API with the help of curl thats working fine but I have ADD button on my Page and I wants to use ajax to call API for adding data on clicking on add button.

how should I do it ?

I have created REST in Zend with dynamodb as backend.

网友答案:

we can call ajax onCLick of button and call AJAX like..

$('#btnadad').on('click',function (e){       
   alert("ok");
   $.ajax({
   type:'GET',
   url :"/tournament",
   dataType: 'json',
   success: function(data) {
        console.log('success',data);

   },
   error:function(exception){alert('Exeption:'+exception);}
}); 
 e.preventDefault();
});
分享给朋友:
您可能感兴趣的文章:
随机阅读: