anonymous
  • anonymous
What is the best way to get data from a #sql-server, when i want to process it on the client side via #javascript? I have a IIS webserver with MS SQL Server database. On my website, i want to get data from the database to process it as JSON. I tried with php, but i have to store the sql-results in html first, before i can read them with javascript. since the datasets are pretty big, it does not seem like nice solution to me. What about AJAX? I don't know so much of it. Could be a better solution?
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
jamiebookeater
  • jamiebookeater
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
Best solution is subjective, you could use node.js (serverside javascript) to query and expose the data to your client-side javascript, alternatively you could write a simple api server in Python that would query based on what you need at that time and return you json, PHP could do it, if the dataset is large you're going to be retrieving it large no matter what, anyway, you could invoke dynamic output so that the dataset returned is only as large as it needs to be for that particular piece of json. You could also approach it with technically like AJAX which is really just a fake socket implementation for client-side javacript to perform polling. However you would still need some technology in place to handle that request as it cannot communicate directly with MSSQL.
anonymous
  • anonymous
typo correction: technology like AJAX**
anonymous
  • anonymous
In the end I used the php library sql2json, which transforms my sql result in php to a json-string, which is stored in html. on the client side, i read this string from the DOM with javascript and do eval(). still i think it's a strange solution, since this should be an everyday-task, no.

Looking for something else?

Not the answer you are looking for? Search for more explanations.