Posts

Showing posts with the label JQuery

HTML5 Geolocation

Image
Code download available at the bottom of the post In this tutorial we will use Jquery,Goople Api and HTML5 to capture geolocation Browser used:Google Chrome Step 1: Include the Jquery and Goople maps API as shown below     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" type="text/javascript"></script>     <script src="http://maps.google.com/maps/api/js?sensor=true"></script> Step 2: Add a place holder for the Map <div id="map"> </div> Using HTML5 feature we will display the latitude and longitude, so add placeholders for latitude and longitude.  <div id="lat"></div> <div id="long"></div> Step 3:   Start writing code to capture the Geolocation <script> //using navigator (Html 5 feature) to get the Geolocation x = navigator.geolocation; x.getCurrentPosition(sucess,failure); 'getCurrentPosition' m...

Jquery not working

Image
6 steps to take if your jQuery is not working 1. The file is not there or does not exist People tend to become upset and/or frustrated (Including me) when something simple doesn’t work, such as  jQuery not working . Before you do anything, navigate to your jQuery file and check that it is exactly where it should be. Also make sure that you have the correct html file open – I have actually tried to load files using the incorrect html, so the path would have been correct if I had the correct html file open. Don’t ever be too proud to check the absolute basics. 2. Incorrect File Path This is a common problem and it is the first thing I check when I’m having a javascript problem (I actually do step 1 and 2 with my style.css as well). After checking that the file path is correct, I double check by viewing the page source using Firefox, I then click on the .js link. If it opens up the jQuery file (Double check it is opening the correct file) then the destination is correct. I...

Calling Server Side Method Using jQuery/Ajax

With this post I would show how to call server side method from client side. Here we will use jQuery to utilize the Ajax Capabilities which will help us to get/post data to/from server Asynchronously. There are many methods available to perform an async callback to the server. Here I will show a simple example as in how to call a code behind Webmethod. For simplicity I would be calling the code behind method on a Button Click. Here is the code: Aspx markup : 1: <asp:Button ID= "Button1" runat= "server" Text= "Click" /> 2: <br /><br /> 3: <div id= "myDiv" ></div> jQuery : 1: <script src= "http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type= "text/javascript" ></script> 2: <script type = "text/javascript" > 3: $(document).ready(function () { 4: $( '#<%=Button1.ClientID %>' )...

jQuery : Expandable Sidebar Menu

jQuery Demo - Expandable Sidebar Menu from John Resig on Vimeo .