Posts

Showing posts from October, 2013

CREATE-REMOVE-ADD IN JSON USING JAVASCRIPT

//CREATING JSON OBJECT         var Obj = { Languages: [] };         //ADDING ITEMS TO JSON OBJECT         Obj.Languages.push({ id: "1", Name: 'C Language' });         Obj.Languages.push({ id: "2", Name: 'C++ Language' });         Obj.Languages.push({ id: "3", Name: 'JAVA' });         Obj.Languages.push({ id: "4", Name: 'JAVASCRIPT' });         Obj.Languages.push({ id: "5", Name: 'JQUERY' });         //REMOVING ITEMS FROM JSON OBJECT         Obj.Languages.pop();         //REMOVING PARTICULAR ITEM FROM JSON OBJECT         Obj.Languages.splice(2, 1);         //ADDING NEW ITEM IN MIDDLE         //SIGNATURE OF splice(INDEX, COUNT TO DELETE FROM INDEX, JSON OBJECT TO ADD NEW ITEM)         Obj.Languages.splice(2, 0, { id: 5, Name: 'DOTNET' });

CALCULATING DISTANCE BETWEEN TWO PLACES ASP.NET

Calculating distance between two places made easy by GOOGLE MAP's DISTANCE MATRIX .  Google Map Matrix is an opensource api which will return Json & Xml as responces for its each request. Here we can get google map search suggestions too using google map's javascript api.  By this the text box you enter for desired place will show you google map's search suggestions. Let go to code. Html in aspx file: <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server">     <title>Google Maps</title>     <script src="https://maps.googleapis.com/maps/api/js?sensor=false&libraries=places"         type="text/javascript"></script>     <script type="text/javascript">         //for getting origin autocomplete google map results         function OrginAutoComplete() {             try {                 var input = document.getElementById('TextBox