如何删除jquery json弹出窗口? [英] How to remove jquery json popup?

查看:83
本文介绍了如何删除jquery json弹出窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将在html页面中添加jquery json数据的位置. 所有HTML页面组件均消失,仅在页面左上方显示json数据:

Where I am going to add jquery json data in html page. All HTML page components disappear and only show json data in left top of the page:

$.getJSON('http://api.wipmania.com/jsonp?callback=?', 
    function (data) { 
        document.write('Latitude: ' + data.latitude + '\nLongitude: ' + data.longitude + '\nCountry: ' + data.address.country); 
    }
); 

推荐答案

阅读

Reading the documentation for document.write() we find this:

将文本字符串写入由打开的文档流 document.open(). [...]
正在写入已加载的文档 无需调用document.open()即可自动执行 document.open通话

Writes a string of text to a document stream opened by document.open(). [...]
Writing to a document that has already loaded without calling document.open() will automatically perform a document.open call

...和document.open()文档说:

document.open()方法打开一个文档进行写入. [...]
如果 文档存在于目标中,此方法将其清除

The document.open() method opens a document for writing. [...]
If a document exists in the target, this method clears it

使用document.write()注入原始HTML可能是创建动态文档的最烦人的工具.您正在使用jQuery-利用其DOM操作工具.

Using document.write() to inject raw HTML is possibly the most annoying tool to create dynamic documents. You are using jQuery—make use of its DOM manipulation tools.

这篇关于如何删除jquery json弹出窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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