javascript - When or How should we pass the params to the URL? -
using php, html , javascript. php using mvc framework.
i have fundamental question regarding web communication, perhaps clear things here.
rest apart, , taking "post" , "get":
let's that, if do:
http://blabla.com/companya/income/
list income of given company.
if do:
http://blabla.com/companya/income/2010/
list income on 2010 company.
and on.
now, wish allow user to, html form, select values, , according values, return, server, appropriate data.
how work?
a) should concatenate url string on client side, (form action) , send server side?
b) our, should send params server side, , returns url?
anyway work? 1 way work? consequences of paths? there third possibility?
a) should concatenate url string on client side, (form action) , send server side?
that's how it's been done historically , still works fine. it's equivalent of constructing complete html hand, using php (or server side language) remove manual labor, basing html on data have easy access to.
b) our, should send params server side, , returns url?
that's unnecessary, have data ready going a) more solid since lets client become bit dumber, excluding render-url-from-arguments logic.
is there third possibility?
yes. since expose lists of resources @ /companya/income/2010/ (perhaps through json), serve empty page server side, trigger ajax call backend , generating list dynamically on client side. brings bunch of things think of, are:
- how seo affected when (google) bots request empty pages?
- can reuse rendering logic different views, without reloading empty page?
you read on spa, or, single-page applications.
Comments
Post a Comment