科尔多瓦开发_科尔多瓦:AJAX简介

科尔多瓦开发

AJAX stands for Asynchronous Javascript And XML. It is a client-side script used in Javascript to communicate with server to exchange data or anything without refreshing the page.

AJAX代表异步Javascript和XML 。 它是Java脚本中用于与服务器通信以交换数据或任何内容而无需刷新页面的客户端脚本。

Let us suppose we want to make a dynamic cordova based application where user needs to exchange data with server, say login credential verification, so we can use AJAX to send the data to the server and through the same gateway server, send the result back to the user.

让我们假设我们要创建一个基于动态Cordova的应用程序,其中用户需要与服务器交换数据,例如登录凭据验证,因此我们可以使用AJAX将数据发送到服务器并通过同一网关服务器,然后将结果发送回用户。

Ajax basic code: We will use jquery.

Ajax基本代码:我们将使用jquery。

$.ajax is a jQuery function to make http POST, GET etc request to the server and receive results without the page being refreshed or reloaded.

$.ajax是一个jQuery函数,用于向服务器发出http POSTGET等请求并接收结果,而无需刷新或重新加载页面。

$.ajax({
    type : 'get',	//Request method: GET, POST  
    url : 'http://studytonight.php/login.php',  //Where to send the data
    data: {name, password},  //What data you want to send
    success:function(data) {  
        //Here you will receive data from server
        //Do what you want to do with data                         
        console.log(data)	 //This is a example, like we want to print the result
    }
})

NOTE: Covering Ajax and jQuery is not in the scope of this tutorial. But we strongly advice you to learn abour Ajax, as it is very useful if you want to create dynamic Apps.

注意:涵盖Ajax和jQuery不在本教程的范围内。 但是我们强烈建议您学习Abour Ajax,因为如果您要创建动态应用程序,这将非常有用。

翻译自: https://www.studytonight.com/apache-cordova/introduction-to-ajax

科尔多瓦开发

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值