0

I think the question is self explanatory. How can i get info from sql server database and pass it to my web app so the content is dynamic. How to make a connectivity between html5 and the server? I know is using ajax any examples???? How to do it without jquery? With phonegap?

elvainch
  • 1,369
  • 3
  • 15
  • 32
  • You would need a server-side technology (ASP.NET, PHP, Java, etc.) to handle the requests from the browser, communicate with the database, and return the data to the browser. Even if the browser can communicate with the server's database directly, it sounds like a significant security risk. – David Apr 02 '12 at 23:48
  • I think a quick search would find you many ajax examples. As @David said you'll need some server side technology, most likely ASP.NET if you're using IIS, to connect to the database and serve up the html/json/whatever you choose. – joshuahealy Apr 02 '12 at 23:51
  • exactly but how to connect html5 with asp.net c sharp – elvainch Apr 03 '12 at 02:21

1 Answers1

1

You can make an ajax call from your web app / phonegap app using jquery ajax like this..

$.ajax({
  url: "http://yoursite.com/getuser.aspx",
  context: document.body
}).done(function() { 
  $(this).addClass("done");
});

In this case yoursite.com is your domain and the aspx page in its code behind will connect to sql server and get data out. You can also add some security to this using oAuth or some form of login token auth if you need to. Does that help?

  • what about without using jquery? – elvainch Apr 02 '12 at 23:56
  • 1
    It depends on where you want to use this.. if a web application you need to do a XMLHttpRequest based on the browser, too much coding and I would rather just use jquery. Look at http://www.w3schools.com/xml/xml_http.asp – Anand Nandakumar Apr 03 '12 at 00:02
  • Um..the above example **is** jquery. You can do what you need to do using client (jquery/javascript) and server side (C#, vb.net, php, etc. etc). Connecting to your database and obtaining data will be done on the server side. Displaying that data can be done either client side or server side. – EdSF Apr 03 '12 at 04:05