<script type="text/javascript"> jQuery('body').on('click','.close_menu',function(e) { window.parent.jQuery('.menu_holder').hide(); }) </script>
//orientation var orientation =”; var win_width = $( window ).width(); var win_height = $( window ).height() if( win_width > win_height ) { $(“html”).removeClass(‘portrait’); $(“html”).removeClass(‘landscape’); $(“html”).addClass(‘landscape’); orientation=’landscape’; } else { $(“html”).removeClass(‘portrait’); $(“html”).removeClass(‘landscape’); $(“html”).addClass(‘portrait’); orientation=’portrait’; } //device var mob_min = 0; var mob_max = 767;; /*480; /*600px; /*767px; /*480px;*/ var tab_min = mob_max; var tab_max = 1024; var pc_min = tab_max; if(orientation==’landscape’) { if(win_width <= mob_max) { set_device('MOBILE'); } else if(win_width <= tab_max) { set_device('TAB'); } else { set_device('PC'); } } else { if(win_height <= mob_max) { set_device('MOBILE'); } else if(win_height <= tab_max) { set_device('TAB'); } else { set_device('PC'); } }
if($(“#isAgeSelected”).is(‘:checked’)) $(“#txtAge”).show(); // checked else $(“#txtAge”).hide(); // unchecked
sysntax:-
jQuery.get( url [, data ] [, success(data, textStatus, jqXHR) ] [, dataType ] ) $.ajax({ url: url, data: data, success: success, dataType: dataType }); $.get( "ajax/test.html", function( data ) { $( ".result" ).html( data ); alert( "Load was performed." ); }); $.get( "test.php", { name: "John", time: "2pm" } ); $.get( "test.php", { "choices[]": ["Jon", "Susan"] } ); $.get( "test.php", function( data ) { alert( "Data Loaded: " + data ); }); $.get( "test.cgi", { name: "John", time: "2pm" } ) .done(function( data ) { alert( "Data Loaded: " + data ); }); $.get( "test.php", function( data ) { $( "body" ) .append( "Name: " + data.name ) // John .append( "Time: " + data.time ); // 2pm }, "json" );
Description: Load data from the server using a HTTP POST request.
syntax:-
jQuery.post( url [, data ] [, success(data, textStatus, jqXHR) ] [, dataType ] ) $.ajax({ type: "POST", url: url, data: data, success: success, dataType: dataType }); $.post( "ajax/test.html", function( data ) { $( ".result" ).html( data ); }); $.post( "test.php", { name: "John", time: "2pm" } ); $.post( "test.php", { 'choices[]': [ "Jon", "Susan" ] } ); $.post( "test.php", $( "#testform" ).serialize() ); $.post( "test.php", function( data ) { alert( "Data Loaded: " + data ); }); $.post( "test.php", { name: "John", time: "2pm" }) .done(function( data ) { alert( "Data Loaded: " + data ); }); $.post( "test.php", { func: "getNameAndTime" }, function( data ) { console.log( data.name ); // John console.log( data.time ); // 2pm }, "json"); <script> // Attach a submit handler to the form $( "#searchForm" ).submit(function( event ) { // Stop form from submitting normally event.preventDefault(); // Get some values from elements on the page: var $form = $( this ), term = $form.find( "input[name='s']" ).val(), url = $form.attr( "action" ); // Send the data using post var posting = $.post( url, { s: term } ); // Put the results in a div posting.done(function( data ) { var content = $( data ).find( "#content" ); $( "#result" ).empty().append( content ); }); }); </script>
dataType
is provided, but can be null
in that case.