字符串到json对象的URL [英] String URL to json object

查看:146
本文介绍了字符串到json对象的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从字符串网址中创建一个JSON对象但没有成功

I was trying to make a JSON Object from a String URL without success

我有这个:

var URL = "http://localhost/index.php?module=search&param1=4";

我需要这个:

var dir = index.php;
var result = {
           module:'search',
           param1:4
             };

任何人都可以帮我提供代码吗?

Can anyone help me with the code?

推荐答案

在这里发布链接并不完全正确,但在这种情况下,OP需要的只是一些解析网址的库。

It's not entirely correct to post a link here, but in this case what OP needed is just some library to parse urls.

这里是: http://james.padolsey.com / javascript / parsing-urls-with-the-dom /

这篇关于字符串到json对象的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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