Posts

Showing posts with the label Ajax

jQuery Ajaz to check if returned data object is empty

Image
In one of my jQuery Ajax Request ,I need to check wehter quary  return  empty results. $ . post ( "php/socialbookmark-post.php" , { bookmarkID : $ ( this ). val ()}, function ( data ) { if ( data != "" ) alert ( data ); });   data !== 'undefined' && data !== '' not worked Properly and Stack OverFlow also not given good answer. I observed, If empty data set  returned , the full block will not executed. http://stackoverflow.com/questions/2589558/jquery-to-check-if-returned-data-object-is-empty But refffering to jQuery I able to come up with solid answer. http://api.jquery.com/jQuery.ajax/ By defult we inherit the sucess method (done ) and if empty data set returned it will go (fail).     $.post("./testURL" function (o) {                                 ...

jQuery Datatable with the ajax Json String

Image
You  can integrate  jQuery Datatable with the ajax source in following way. Download Realse Packages  https://datatables.net/download/ Import JS and CSS <script src="public/js/jquery.dataTables.min.js" type="text/javascript"></script>  <link href="public/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css"/> HTML    <div class="col-md-12 table-responsive">                        <!-- <table id="table" class="table  table-bordered table-striped ">-->    <table id="table" class="table table-striped table-hover dt-responsive display nowrap" width="100%" cellspacing="0" >                             <thead>                                 <tr>...

Send Objects within Object using Json -ASP.net (Sub Objects)

The Client server communication based on Well formed JSON string is an effective method to improve the responsiveness within server and browser communication.The rich client with jQury and JavaScript I have used need to generated in the page load which contain the objects (sub objects)  within object (parent objects). Here I have used the Web service class Within visual Studio to define object structure as a class  . Web service definition  namespace testdefultlogin.webservices {     [WebService(Namespace = "http://tempuri.org/")]     [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]     [System.ComponentModel.ToolboxItem(false)]     // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.      [System.Web.Script.Services.ScriptService]     public class clientService : System.Web.Services.WebService   ...