在简单的javascript代码中转换下面的jquery代码 [英] Convert below jquery code in simple javascript code

查看:99
本文介绍了在简单的javascript代码中转换下面的jquery代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$.ajax( { 
    url: 'https://api.mlab.com/api/1/databases/my-db/collections/my-coll?apiKey=myAPIKey&q={"_id":1234}',
    data: JSON.stringify( { "$set" : { "x" : 3 } } ),
    type: "PUT",
    contentType: "application/json" } );





我尝试了什么:



我在网上尝试过,但找不到任何解决办法。



What I have tried:

I tried online but can not find any solution for this.

推荐答案

.ajax({
url:' https:/ /api.mlab.com/api/1/databases/my-db/collection s / my-coll?apiKey = myAPIKey& q = {_ id:1234}'
data: JSON .stringify({
.ajax( { url: 'https://api.mlab.com/api/1/databases/my-db/collections/my-coll?apiKey=myAPIKey&q={"_id":1234}', data: JSON.stringify( { "


set:{ x 3 }}),
类型: PUT
contentType: application / json});
set" : { "x" : 3 } } ), type: "PUT", contentType: "application/json" } );





我尝试了什么:



我在网上尝试过,但找不到任何解决办法。



What I have tried:

I tried online but can not find any solution for this.


那个简单的JQuery调用在简单JavaScript中包含大约200行代码...要编写它,你必须学习很多关于AJAX和跨浏览器的兼容性......所以从那里开始...

(但是当你在阅读时想想为什么?...为什么这么愚蠢的想法)
That simple call of JQuery encloses some 200 lines of code in 'simple' JavaScript...To write it, you have to learn a lot about AJAX and cross-browser compatibility...So start there...
(But while you are reading think about the WHY?...Why do such a foolish think)

这篇关于在简单的javascript代码中转换下面的jquery代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆