views:

158

answers:

1

I used SPRY about a year ago to experiment with the fact that you could essentially load a "dataset" into Javascript/browser, and act upon that to bind to form fields like textboxes, combo dropdowns etc.

I really have been trying to find something really simple to allow me (a coder) to write the backend code to get the data, and my partner (who designs etc) to simply use her skills to layout the HTML, and have a simple way to bind data to those form values/grids etc.

I have tried experimenting with the likes of ExtJS and that type of thing, but find it a little hard to explain to my partner, whereas when I did use SPRY, it seemed quite "natural" to explain to my design partner how to use. The only issue with SPRY is that it seems to have either slowed right down (development that is) or something..

I love jQuery, but not sure if there is something that is similar out there?

A: 

It will always depend on the nature of data you're trying to bind.

JSON is a great language for exchanging lightweight data between server and client: it's basically JavaScript Object Notation.

If you're talking about jQuery, then I assume your partner has some knowledge of coding and JavaScript; or at least you do.

Then what I suggest (that's what I do for my own projects) is to output your data in JSON format from your backend then read it from jQuery and cycling through it:

jQuery.getJSON("url", parameters, function (jsonData){
  // Assuming jsonData is an array:
  for(var i = 0; i < jsonData.length; i++){
    // Do something with jsonData[i]
  }
});

There are plenty of tools to convert data to JSON format; just as an example, in PHP there's the json_encode function.

Communication between backend and frontend always required (and always will) programming to some extent. If your partner doesn't have programming skills, then I'd suggest you wrap some usual features into friendlier functions:

function fillSelect(selectId, urlWithData){
  // Request JSON data and fill the <SELECT> accordingly.
}

Then she could do something as easy as

fillSelect("mySelect", "http://www.example.com/givemesomejson");

Hope that helps :)

Seb