javascript - 使用 Titanium 的 RESTful 服务

标签 javascript http titanium

是否有办法从 Titanium 执行 HTTP PUT/DELETE 方法?他们得到支持吗?是否有任何第三方库或解决方法可以处理它?<​​/p>

最佳答案

是的,您可以在 HTTPClient 中将 PUT/DELETE 作为动词发送

var url = "http://www.appcelerator.com";
 var client = Ti.Network.createHTTPClient({
     // function called when the response data is available
     onload : function(e) {
         Ti.API.info("Received text: " + this.responseText);
         alert('success');
     },
     // function called when an error occurs, including a timeout
     onerror : function(e) {
         Ti.API.debug(e.error);
         alert('error');
     },
     timeout : 5000  /* in milliseconds */
 });


 // Prepare the connection.
 // This accepts PUT/DELETE/GET/POST
 client.open("PUT", url);
 // Send the request.
 client.send();

关于javascript - 使用 Titanium 的 RESTful 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9347708/

相关文章:

angularjs - Angular 指令、http 请求和 ng-repeat

c# - 在 session 结束时或在特定时间使 cookie 过期?

ios - Ti.Facebook 未打开授权并安装了 FB 应用程序

android - Titanium:iPhone 应用程序到 android 的问题

ios - 在 iOS 钛中向上移动键盘显示的 View

javascript - 未生成来自 tailwind.config.js 的自定义顺风颜色

javascript - 将错误从一个异步函数传递到另一个

javascript - 使用 Javascript 提交到特定按钮?

django - 向 django CBV 添加 header

c# - 如何阻止浏览器(尤其是Internet Explorer)进行JavaScript的 super 缓存?