returning JSON and HTML from PHP script

前端 未结 3 607
清酒与你
清酒与你 2020-12-30 04:14

Hi searched through the questions here, but couldn\'t find anything. I\'m new at writing PHP and jQuery, so bear with me.

What I\'m trying to do is send an ajax requ

3条回答
  •  借酒劲吻你
    2020-12-30 04:49

    You might be interested in jLinq, a Javascript library that allows you to query Javascript objects. A sample query would be:

    var results = jLinq.from(data.users)
        .startsWith("first", "a")
        .orEndsWith("y")
        .orderBy("admin", "age")
        .select();
    

    jLinq supports querying nested objects and performing joins. For example:

    var results = jLinq.from(data.users) 
        .join(data.locations, //the source array 
            "location", //the alias to use (when joined) 
            "locationId", // the location id for the user 
            "id" // the id for the location 
        ) 
        .select(function(r) { 
            return { 
                fullname:r.first + " " + r.last, 
                city:r.location.city, 
                state:r.location.state 
            }; 
        }); 
    

提交回复
热议问题