I have a widget which has to fetch json data. The json data will change…
I have two options to include the content in the boot-loader file.
———————————————————————————————————–
- Include a javascript file with the data and a function to process that data as the file is included completely.
OR
- Use ajax to get the json data.
———————————————————————————————————–
-
Which has better interface?
-
Which is easier to code?
-
Which is less error prone?
-
Which is more compatible to browsers?
-
Which is lighter and faster to execute on the client side?
Which has better interface?
javascript inclusion is easier to use. also you wouldn’t need to use jquery so that would reduce the size of the widget as well.
Which is easier to code?
javascript inclusion is easier to use.
Which is less error prone? Which is more compatible to browsers?
javascript inclusion method of jsonp which you are using is cross-domain compatible and there are going to be less errors with it.
Which is lighter and faster to execute on the client side?
depends really…but there shouldn’t much difference in execution but rather fetching the widget which shouldn’t be much different either.
Use javascript file inclusion