是否可以使用jquery从URL获取数据
例如,如果你有 www.test.com/index.html?id=1&name=boo
如何获得身份证和姓名?
var myData = [
{"Identifier":1,"Naam":"Van Der Valk","Adres":"Europaweg 218","Postcode":"1238AC","Plaats":"Zoetermeer","Longitude":"4.48822","Latitude":"52.06258", "Status":"Laadpunten Beschikbaar", "lunch":"true", "diner":"true", "meet":"true", "wifi":"true", "Distance": "10.1"},
{"Identifier":2,"Naam":"Meram place","Adres":"NOT Given 1","Postcode":"0000LL","Plaats":"Rotterdam","Longitude":"4.48178","Latitude":"51.92422", "lunch":"false", "Distance": "181"},
{"Identifier":3,"Naam":"Station Zwolle","Adres":"NOT Given 6","Postcode":"0000LL","Plaats":"Zwolle","Longitude":"6.08302","Latitude":"52.51677", "lunch":"false", "Distance": "5.1"},
{"Identifier":4,"Naam":"Pompstation Shell","Adres":"NOT Given 1","Postcode":"0000LL","Plaats":"Den Haag","Longitude":"4.30070","Latitude":"52.07050", "lunch":"false"},
{"Identifier":5,"Naam":"Amsterdam Arena","Adres":"NOT Given 218","Postcode":"0000LL","Plaats":"Amsterdam","Longitude":"4.89517","Latitude":"52.37022", "lunch":"true", "diner":"true", "wifi":"true", "meet":"true", "Distance": "34.2"}
];
Run Code Online (Sandbox Code Playgroud)
我有一个问题,给定我有上面的json ..,我想将此附加到列表中,即ul li ..怎样才能使列表以距离最小的列表排序等等。
我正在遵循Book Professional ASP.NET MVC 2中的NerdDinner部分.目前我正处于需要实现DinnerFormViewModel和Renderpartial Dinnerform的部分.这本书包含一些错误,因此我尝试在互联网上搜索并自行修复..
我已将DinnerFormViewModel放在Models文件夹中,这是代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace NerdDinner.Models
{
public class DinnerFormViewModel : Controller
{
private static string[] _countries = new[]{
"USA",
"Ireland",
"Scotland",
"Namibia"
};
//Properties
public Dinner Dinner { get; private set; }
public SelectList Countries { get; private set; }
//Constructor
public DinnerFormViewModel(Dinner dinner)
{
Dinner = dinner;
Countries = new SelectList(_countries, dinner.Country);
}
// GET: /DinnerFormViewModel/
public ActionResult Index()
{
return View();
}
}
} …Run Code Online (Sandbox Code Playgroud)