I have a price matrix that I would like to use for a price lookup. The top row are numbers which represent the width of a开发者_开发问答n item in inches. The side column of numbers represent the length. The numbers inside the matrix are the prices.
I was thinking about using an XML file to hold this data and then use X,Y to find the price. But I can't find anything on the internet that tells me how this is done. So my first questions are: Can this be done and is it the smart way to do it?
Or I could create an array of this data and find the price by perhaps using JQuery, although I have not found anything on how to do that either. So my next questions are basically the same: Can this be done and is it the smart way to do it?
My final question is this: Is there a better way to do this and if so what would you recommend?
Whatever you think might be the best way to do this, could you give me an example of the JQuery code that would do it.
Thanking you in advance.
You can just use simple javascript and hold the data in a 2-dimensional array, as is described here: how to create a two-dimensional array in javascript.
usually storing static information (that shouldn't change much) in external files, but I agree with @Blender that XML is a bit overkill.
精彩评论