Search Results

Search found 8063 results on 323 pages for 'ajax'.

Page 9/323 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Microsoft, jQuery, and Templating

    - by Stephen Walther
    About two months ago, John Resig and I met at Café Algiers in Harvard square to discuss how Microsoft can contribute to the jQuery project. Today, Scott Guthrie announced in his second-day MIX keynote that Microsoft is throwing its weight behind jQuery and making it the primary way to develop client-side Ajax applications using Microsoft technologies. What does this announcement mean? It means that Microsoft is shifting its resources to invest in jQuery. Developers on the ASP.NET team are now working full-time to contribute features to the core jQuery library. Furthermore, we are working with other teams at Microsoft to ensure that our technologies work great with jQuery. We are contributing to the open-source jQuery project in the exact same way that any other company or individual from the community can contribute to jQuery. We are writing proposals, submitting the proposals to the jQuery forums, and revising the proposals in response to community feedback. The jQuery team can decide to reject or accept any feature that we propose. Any feature that Microsoft contributes to jQuery will be platform neutral. In other words, Microsoft contributions will benefit PHP and RAILS developers just as much as they benefit ASP.NET developers. Microsoft contributions to jQuery will improve the web for everyone. Contributing Support for Templates to jQuery Core Our first proposal concerns templating. We want to contribute support for templates to jQuery so that JavaScript developers can use jQuery to easily display a set of database records. You can read our templating proposal here: http://wiki.github.com/nje/jquery/jquery-templates-proposal You can download and play with our prototype for templating here: http://github.com/nje/jquery-tmpl The following code illustrates how you can use a template to display a set of products in a bulleted list: <script type="text/javascript"> jQuery(function(){ var products = [ { name: "Product 1", price: 12.99}, { name: "Product 2", price: 9.99}, { name: "Product 3", price: 35.59} ]; $("ul").append("#template", products); }); </script> <script id="template" type="text/html"> <li>{%= name %} - {%= price %}</li> </script> <ul></ul> The template is contained in a SCRIPT element that has a TYPE=”text/html” attribute. Browsers ignore the contents of a SCRIPT element when they don’t understand the content type. Notice that the placeholder {%=...%} is used within the template to indicate where the name and price of a product should appear. The delimiters {%=…%} are used for expressions and the delimiters {%...%} are used for code. Finally, the products are rendered using the template with the call to $(“ul”).append(“#template”, products). The standard jQuery DOM manipulation methods have been modified to support templates. When the page above is rendered, you get the bulleted list displayed in the following figure. Our goal is to keep our proposal for templates as simple as possible. After support for templating has been added to jQuery, plug-in authors can take advantage of templating when building complex data-driven plug-ins such as a DataGrid plug-in. The Ajax Control Toolkit Over 100,000 developers download the Ajax Control Toolkit every month. That’s a mind-boggling number of downloads. We realize that the Ajax Control Toolkit is extremely popular among ASP.NET Web Forms developers and we want to continue to invest in the Ajax Control Toolkit. If you are adding JavaScript interactivity to an ASP.NET Web Forms application, and you don’t want to write JavaScript, then we recommend that you use the server controls in the Ajax Control Toolkit. Using the Ajax Control Toolkit does not require knowledge of JavaScript and the toolkit enables you to build applications with the concepts familiar to ASP.NET Web Forms applications developers. If, however, you are interested in creating client-side interactivity without server controls then we recommend that you use jQuery. We plan to continue to release new versions of the Ajax Control Toolkit every few months. Our goal is to continue to improve the quality of the Ajax Control Toolkit and to make it easier for the community to contribute code, bug fixes, and documentation. The ASP.NET Ajax Library We are moving the ASP.NET Ajax Library into the Ajax Control Toolkit. If you currently use ASP.NET Ajax Library client templates, client data-binding, or the client script loader then you can continue to use these features by downloading the Ajax Control Toolkit. Be aware that our focus with the Ajax Control Toolkit is server-side Ajax.  For client-side Ajax, we are shifting our focus to jQuery. For example, if you have been using ASP.NET Ajax Library client templates then we recommend that you shift to using jQuery instead. Conclusion Our plan is to focus on jQuery as the primary technology for building client-side Ajax applications moving forward. We want to adapt Microsoft technologies to work great with jQuery and we want to contribute features to jQuery that will make the web better for everyone. We are very excited to be working with the jQuery core team.

    Read the article

  • How much PHP do I need to know to use AJAX?

    - by user1146440
    Hi I am interested in learning to create AJAX calls with Javascript.I already know Javascript and I would like to learn PHP at some point but at the moment I know nothing about it and I don't have the time to learn the full language. How much PHP do I need to know to be able to do AJAX calls? Can someone recommend me some good resources to get familiar with what I need to learn from PHP so I can learn AJAX.I am planing on starting to read AJAX and PHP: Building Modern Web Applications 2nd Edition but I think I need to know some basic PHP.

    Read the article

  • How to send set of data for Ajax call from jquery with php at the serverside?

    - by Vinodtiru
    I basically have to do a update of a record. I have a set of controls like textbox, list box, radio button etc. Then i have a button on click of which i need to carry all the updated data into mysql database with a ajax request without page refresh. I am using the php with codeigniter as my serverside code. On client side i am able to send the ajax request like $(document).ready(function(){ $('#users_menu').click( function(){ $('#tempdiv').load('http://localhost//web1/index.php/c1',null); } ); }); In the above code the request is placed to a server side php page where i am not able to read the values of the control values (values of textbox, listbox etc). Now this means i should be sending the list with the request. But i am not aware of how to send this request. Please help me with some details of how to send the list of values or is it possible to read the vaules some how in the serverside php code. For your information i am using codeigniter with my php. Any kind of help is appreciated. Thanks and Regards VinodT.

    Read the article

  • Comet and Simultaneous Ajax request

    - by Amitd
    Hi , I am trying to use a COMET solution using ASP.NET . Trouble is i want to implement sending and notification part in the same page. On IE7, whenever i try to send a request ,it just gets queued up. After reading on internet and stackoverflow pages i found that i can only do 2 simultaneous asyn ajax requests per page. So until i close my comet Ajax request,my 2nd request doesnt get completed ,doesnt even go out from the browser. And when i checked with Firefox i just one Ajax comet request running all time..so doesnt that leave me one more ajax request? Also the solution uses IRequiressessionstate for Asynchronous HTTP Handler which i had removed.but still it creates problems on multiple instances of IE7. I had one work around which is stated here http://support.microsoft.com/kb/282402 it means we can increase the request limit from registry by default is 2. By changing "MaxConnectionsPer1_0Server" key in hive "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" we can increase the number of requests. Basically i want to broadcast information to multiple clients connected to a server using Comet and the clients can also send messages to the Server. Broadcasting works but the send request back to server doesnt work. Im using IIS 6 and ASP.NET . Are there any more workarounds or ways to send more requests? References : http://stackoverflow.com/questions/561046/how-many-concurrent-ajax-xmlhttprequest-requests-are-allowed-in-popular-browser http://stackoverflow.com/questions/349381/ajax-php-sessions-and-simultaneous-requests http://stackoverflow.com/questions/2412807/jquery-ajax-request-blocked-by-long-running-ajax-request http://stackoverflow.com/questions/898190/jquery-making-simultaneous-ajax-requests-is-it-possible

    Read the article

  • please clarify some aspects of AJAX with ASP.NET web forms for a beginner

    - by citrus
    Im familiar with asp.net web forms. I would now like to move on to writing web applications that use AJAX. I would like to get to the stage where I can create an app: that has "edit in place" (no page reload) where i can reorder images using drag and drop (also saves the order to DB) that has google like search suggestions while typing on the fly 1)So do I need to learn how to use AJAX.net and Jquery(my JS library of choice)? Can I make do using only AJAX.net or only Jquery? 2)As far a I know, Jquery will allow me to perform client side manipulations/actions and AJAX.net is the part that will allow me to connect some of my actions to the Server. EG. if I wanted to re-order elements using drag and drop, I would use Jquery, but in order to save the result of the re-order to the DB I would have to use AJAX.net correct? 2a)So In order to learn how to do the above Im thinking I should first learn Jquery so I know how to manipulate/ select elements, and then I can lean how to save these changes to the DB. 3)I searched the books titled "ASP.net AJAX in action" and ASP.net 3.5 AJAX, both of these books did not contain any references to "Jquery". Is this because they may be using a different JS library, or perhaps the book focuses on the AJAX user controls? I just found it confusing that 2 popular AJAX books dont make any reference to Jquery. Thanks for any help.

    Read the article

  • how to queue function behind ajax request

    - by user1052335
    What I'm asking is conceptual rather than why my code doesn't work. I'm trying to make a web app that displays content fetched from a database in a sequence, one at a time, and then waits for a response from the user before continuing to the next one. I'm working with javascript on the client side with the JQuery library and php on the server side. In theory, there's time while waiting for the user's input to fetch information from the server using an AJAX request and have it ready for the use by the time he clicks the button, but there's also a chance that such an AJAX request hasn't completed when he clicks the button. So I need something like pseudocode: display current information fetch next data point from the server in the background onUserInput { if ( ajax request complete) { present the information fetched in this request } else if (ajax request not complete) { wait for ajax request complete present information to user } My question is this: how does one implement this " else if (ajax request not complete) { wait for ajax request complete " part. I'm currently using JQuery for my AJAX needs. I'm somewhat new to working with AJAX, and I did search around, but I didn't find anything that seemed on point. I don't know what tools I should use for this. Some kind of queue maybe? I don't need to be spoon fed. I just need to know how this is done, using what tools or if my desired outcome would be accomplished in some other way entirely. Thanks.

    Read the article

  • Should we be using JQuery for Mobile AJAX Page Navigation?

    - by Brad
    I am developing a mobile site that will load page content using AJAX if JavaScript is enabled. I have been using the JQuery load() functionality to load page contents from other static pages but I feel I am wasting precious bandwidth loading the entire JQuery library when I'm only using a small piece of it. With this said should we be avoiding libraries when only using small pieces of them?

    Read the article

  • ajax in zend frame work

    - by rookie
    Hi, I am new to Zend Frame Work. I am using $ajaxContext = $this-_helper-getHelper('AjaxContext'); for adding action contexts. I have one Index.phtml page and all other views are ajax.phtml pages. I have to do some java script methods in the ajax.phtml pages. But i didn't find a way to refer the js files in the ajax.phtml pages. I have tried adding those in the controller init and index action, using $this-view-headScript()-appendFile, though i have the reference added in the page source, none of htese seems to be working on the ajax content. Then i tried to add it in the action for the ajax page, then it is not coming in the page source itself. As far as i understood, $this-view-headScript()-appendFile will append the file reference to the layout page and for the ajax.phtml pages, the layout will be disabled. Is there any way that i can refer my js files in the ajax.phtml pages?

    Read the article

  • Google Ajax Search results differ from "normal" Google Results ?

    - by jAndy
    Hi Folks, I guess anything important you might have to know is within the title. If I use the Google Ajax WebSearch API with, for instance, "Dummy Search" as phrase, my resultset is a different one than if I perform the same phrase over google.com. How can that be? My querystring paramter options are exactly the same, language etc. Thanks in Advance & Kind Regards

    Read the article

  • how to catch ajax query post error?

    - by TTCG
    I would like to catch the error and show the appropriate message if the ajax request fails. My code is like the following, but I could not manage to catch the failure ajax request. function getAjaxData(id) { $.post("status.ajax.php", {deviceId : id}, function(data){ var tab1; if (data.length>0) { tab1 = data; } else { tab1 = "Error in Ajax"; } return tab1; }); } I found out that, "Error in Ajax" is never executed when the Ajax request failed. How to handle the ajax error and show the appropriate message if it fails? Thanks very much.

    Read the article

  • jQuery ajax callback function not working

    - by Harish Kurup
    I am using Symfony PHP Framework to create web application, and using symfony Forms to create the HTML forms. I am trying to load the data in Select element using Ajax, for that i am using jQuery's Ajax functions. It is working fine as it sends and gets the response correctly(status as 200), but not calling the Callback function in some browsers such as IE,Chrome and Safari.It works fine in Firefox and Opera. the Code that is not working, $.ajax({ type: 'POST', url: 'form/ajax', async: true, cache: false, dataType : 'json', data: 'id='+ids, success: function(jsonData){ alert("ok go"); } }); the alert "OK Go" is not called in Chrome,IE and Safari But $.ajax({ type: 'POST', url: 'form/ajax', async: true, cache: false, dataType : 'json', data: 'id='+ids, success: alert("ok go"); }); this works, but as per the project i want the JSON data to load in my Select element. is there any thing wrong in the return JSON format or the bug in the jQuery Ajax functions, please help.

    Read the article

  • Hold i ajax call in every minute calling section

    - by gowri
    i am calling ajax every second in page.. Here the server page returns randomly generated number,using this number(converted into seconds) i am triggering another function in ajax success .it works My problem suppose random number = 5 means trigger() function called after 5 seconds using setTimeout,but rember ajax call is triggering every 1 second so trigger function also called many time. i want to make ajax call wait untill trigger function execution.Which means i wanna pause that ajax call untill 5 seconds after that resume How can i do this ? My coding //this ajax is called every minute $.ajax({ type: "POST", url: 'serverpage', data: ({pid:1}), success: function(msg) { var array = msg.split('/'); if(array[0]==1){ setTimeout(function() { trigger(msg); },array[1]+'000'); } } }); //and my trigger function function trigger(value) { alert("i am triggered !"); } server response maybe 1/2 or 1/5 or 1/ 10 or 1/1 here 1/3(this is converted into seconds)

    Read the article

  • How to load an ajax (jquery) request response progressively without waiting for it to finish?

    - by Sebastian
    I want to make a form that will use jquery to submit a list of keyword to a php file, this file could take a lot of time to load depending on the size of the keywords list. What I want to do is to load the php response into a div or container in real time without using iframes. All the ajax request I know have to wait until the request has finished before having access to the response, I need to get access to that response even when it hasn't finished so I can update the progress in real time.

    Read the article

  • jquery multiple ajax check for all done? (order not important)

    - by second
    Is there a neat way to make sure a bunch of ajax callbacks have all finished? They don't need to be executed in order, i just need all the data to be there. one idea is to have them all increment a counter on completion and check if counter == countMax, but that seems ugly. Also, are there sync issues? (from simultaneous read/write to the counter)

    Read the article

  • Jquery Ajax Call In For Loop Only Runs Once - Possible Issue with Timing & Exit Condition?

    - by Grumps
    Background I'm building a form that uses autocomplete against the EchoNest API. First the users picks an artist, using the Artist Suggest call. Next they select a song but the Song and/Or Artist song search doesn't provide a "wild card" search. It only returns exact matches. So based on the forums they suggest building an array of the songs and using auto complete on the array. I can only get a maximum of 100 responses at a time. I do know based on the initial response the number of songs. My Plan: Wrap the ajax call in a for loop ('runonceloop'). Amend the loop exit condition after the first response with the total number of songs. Challenge I'm having: The 'runonceloop' only completes a singe loop because or at least that's what I believe: The exit condition is satisfied before the first response [1] is received. I've tried to adjust the 'exit condition' and 'counter' such that they are set and and increased at the end of the success block. This seems to lock up my browser. Can someone provide some guidance on this situation?[2] I'd really appreciate it. I also don't think turning async off is a good idea because it locks the browser. Response[1]: { "response": { "status": { "code": "0", "message": "Success", "version": "4.2" }, "start": 0, "total": 121, //Used for "songs": [ { "id": "SOXZYYG127F3E1B7A2", "title": "Karma police" }, { "id": "SOXZABD127F3E1B7A2", "title" : "Creep" } ] } } } Code[2] var songsList = []; function getSongs() { var numsongs = 2; //at least 2 runs. var startindex = 0; runonceloop: //<~~~~Referenced in question for (var j = 0;j >= numsongs;) { console.log('numsongs' + numsongs); $.ajax({ url: "http://developer.echonest.com/api/v4/artist/songs", dataType: "jsonp", data: { results: 100, api_key: "XXXXXXXXXXX", format: "jsonp", name: $("#artist").val(), start: startindex }, success: function (data) { var songs = data.response.songs; numsongs = data.response.total; //modify exit condition for (var i = 0; i < songs.length; i++) { songsList.push(songs[i].title); } j +=100;// increase by 100 to match number of responses. } }); }};

    Read the article

  • WebSeal and jsp content updated by Ajax

    - by lior chaga
    Hey, I have a problem running an application on environment with WebSeal. It is a web application with Java server that contains many parts that are replcaed within the page according to user input. For instance - a form called Outer.jsp may contain a form:options combo-box (by spring-forms), that uppon selection of an option, a certain Div is updated with a content produced by a jsp and fetched by an Ajax call (the ajax impementation in the client is done by Prototype JavaScript framework 1.5.1.2). Let's call the content fetched by ajax - Inner.jsp So Outer.jsp is fetching Inner.jsp, which in turn uses js functions in files included by the Outer.jsp. This, I think, is where my problem starts - Inner.jsp is not familiar with any of the functions included in Outer.jsp. And so, almost any operation performed by Inner.jsp is failing miserably. Needless to say - this works perfect when running on environment without WebSeal. Note that the scripting is enabled in WebSeal junction (with the -J option). I also see that the content returned by the Ajax call includes a document.cookie added by WebSeal (not sure it matters to this problem) Can anyone assist? Thanks! Lior

    Read the article

  • Confusion: Ajax Framework vs JavaScript Framework ?

    - by Rachel
    I was under the impression that jQuery is JavaScript Framework, but when am searching for AJAX Framework it appears that jQuery is also being suggested as best AJAX Framework. Reference: Best Ajax Framework My Question: What is Ajax Framework and how it is different from JavaScript Framework like jQuery ? What are best known Ajax Framework ? What are best known JavaScript Framework ?

    Read the article

  • jquery ajax call in onsubmit function is not working

    - by shilna mk
    I have form submission page add_sale.php and an ajax page ajx_check_sale.php.Ajax call is inthe onsubmit function.But ajax is not worikng.Anybody give any solution plz.. I have form submission page add_sale.php and an ajax page ajx_check_sale.php.Ajax call is inthe onsubmit function.But ajax is not worikng.Anybody give any solution plz.. add_sale.php function sale_credit(id) { var cust_name=$('#cust_name').val(); $.ajax({ type: "POST", url: 'ajx_typ1.php', data:'id='+id, success: function(msg) { $("#sale_type1").html(msg); } }); $.ajax({ type: "POST", url: 'ajx_typ3.php', data:'id='+id, success: function(msg) { $("#sale_type3").html(msg); } }); $.ajax({ type: "POST", url: 'ajx_typ2.php', data:'id='+id, success: function(msg) { $("#sale_type2").html(msg); } }); } function validate_form() { var cust_name= $('#cust_name').val(); var total= $('#total').val(); var sale_type= $('#sale_type').val(); if(sale_type=='return') { $.ajax({ type: "POST", url: 'ajx_check_sale.php', data:'cust_name='+cust_name + '&total=' + total, success: function(msg) { alert(msg); /*if(msg==0) { alert("Return is greater then sale"); return false; } */ } }); } } <form action="" method="post" name="adFrm" onSubmit="return validate_form()"> <select name="sale_type" style="width:130px;" id="sale_type" onchange="sale_credit(this.value)" > <option value="">Select</option> <option value="credit">Credit</option> <option value="payment">Payment</option> <option value="return">Return</option> </select> </form> ajx_check_sale.php require_once("codelibrary/inc/variables.php"); require_once("codelibrary/inc/functions.php"); echo $cust_name=$_POST['cust_name']; echo $return=$_POST['total']; $cus="select sum(total) as total_sum from customer where id='$cust_id'"; $cus2=mysql_query($cus); $fet=mysql_fetch_array($cus2); $total=$fet['total_sum']; if($return>$total) { $status=0; echo $status; } else { $status=1; echo $status; }

    Read the article

  • Something is making my page perform an Ajax call multiple times... [read: I've never been more frust

    - by Jack Webb-Heller
    NOTE: This is a long question. I've explained all the 'basics' at the top and then there's some further (optional) information for if you need it. Hi folks Basically last night this started happening at about 9PM whilst I was trying to restructure my code to make it a bit nicer for the designer to add a few bits to. I tried to fix it until 2AM at which point I gave up. Came back to it this morning, still baffled. I'll be honest with you, I'm a pretty bad Javascript developer. Since starting this project Javascript has been completely new to me and I've just learn as I went along. So please forgive me if my code structure is really bad (perhaps give a couple of pointers on how to improve it?). So, to the problem: to reproduce it, visit http://furnace.howcode.com (it's far from complete). This problem is a little confusing but I'd really appreciate the help. So in the second column you'll see three tabs The 'Newest' tab is selected by default. Scroll to the bottom, and 3 further results should be dynamically fetched via Ajax. Now click on the 'Top Rated' tab. You'll see all the results, but ordered by rating Scroll to the bottom of 'Top Rated'. You'll see SIX results returned. This is where it goes wrong. Only a further three should be returned (there are 18 entries in total). If you're observant you'll notice two 'blocks' of 3 returned. The first 'block' is the second page of results from the 'Newest' tab. The second block is what I just want returned. Did that make any sense? Never mind! So basically I checked this out in Firebug. What happens is, from a 'Clean' page (first load, nothing done) it calls ONE POST request to http://furnace.howcode.com/code/loadmore . But every time you load a new one of the tabs, it makes an ADDITIONAL POST request each time where there should normally only be ONE. So, can you help me? I'd really appreciate it! At this point you could start independent investigation or read on for a little further (optional) information. Thanks! Jack Further Info (may be irrelevant but here for reference): It's almost like there's some Javascript code or something being left behind that duplicates it each time. I thought it might be this code that I use to detect when the browser is scrolled to the bottom: var col = $('#col2'); col.scroll(function(){ if (col.outerHeight() == (col.get(0).scrollHeight - col.scrollTop())) loadMore(1); }); So what I thought was that code was left behind, and so every time you scroll #col2 (which contains different data for each tab) it detected that and added it for #newest as well. So, I made each tab click give #col2 a dynamic class - either .newestcol, .featuredcol, or .topratedcol. And then I changed the var col=$('.newestcol');dynamically so it would only detect it individually for each tab (makin' any sense?!). But hey, that didn't do anything. Another useful tidbit: here's the PHP for http://furnace.howcode.com/code/loadmore: $kind = $this->input->post('kind'); if ($kind == 1){ // kind is 1 - newest $start = $this->input->post('currentpage'); $data['query'] = "SELECT code.id AS codeid, code.title AS codetitle, code.summary AS codesummary, code.author AS codeauthor, code.rating AS rating, code.date, code_tags.*, tags.*, users.firstname AS authorname, users.id AS authorid, GROUP_CONCAT(tags.tag SEPARATOR ', ') AS taggroup FROM code, code_tags, tags, users WHERE users.id = code.author AND code_tags.code_id = code.id AND tags.id = code_tags.tag_id GROUP BY code_id ORDER BY date DESC LIMIT $start, 15 "; $this->load->view('code/ajaxlist',$data); } elseif ($kind == 2) { // kind is 2 - featured So my jQuery code sends a variable 'kind'. If it's 1, it runs the query for Newest, etc. etc. The PHP code for furnace.howcode.com/code/ajaxlist is: <?php // Our query base // SELECT * FROM code ORDER BY date DESC $query = $this->db->query($query); foreach($query->result() as $row) { ?> <script type="text/javascript"> $('#title-<?php echo $row->codeid;?>').click(function() { var form_data = { id: <?php echo $row->codeid; ?> }; $('#col3').fadeOut('slow', function() { $.ajax({ url: "<?php echo site_url('code/viewajax');?>", type: 'POST', data: form_data, success: function(msg) { $('#col3').html(msg); $('#col3').fadeIn('fast'); } }); }); }); </script> <div class="result"> <div class="resulttext"> <div id="title-<?php echo $row->codeid; ?>" class="title"> <?php echo anchor('#',$row->codetitle); ?> </div> <div class="summary"> <?php echo $row->codesummary; ?> </div> <!-- Now insert the 5-star rating system --> <?php include($_SERVER['DOCUMENT_ROOT']."/fivestars/5star.php");?> <div class="bottom"> <div class="author"> Submitted by <?php echo anchor('auth/profile/'.$row->authorid,''.$row->authorname);?> </div> <?php // Now we need to take the GROUP_CONCATted tags and split them using the magic of PHP into seperate tags $tagarray = explode(", ", $row->taggroup); foreach ($tagarray as $tag) { ?> <div class="tagbutton" href="#"> <span><?php echo $tag; ?></span> </div> <?php } ?> </div> </div> </div> <?php } echo "&nbsp;";?> <script type="text/javascript"> var newpage = <?php echo $this->input->post('currentpage') + 15;?>; </script> So that's everything in PHP. The rest you should be able to view with Firebug or by viewing the Source code. I've put all the Tab/clicking/Ajaxloading bits in the tags at the very bottom. There's a comment before it all kicks off. Thanks so much for your help!

    Read the article

  • jQuery, ASP.NET, and Browser History

    - by Stephen Walther
    One objection that people always raise against Ajax applications concerns browser history. Because an Ajax application updates its content by performing sneaky Ajax postbacks, the browser backwards and forwards buttons don’t work as you would normally expect. In a normal, non-Ajax application, when you click the browser back button, you return to a previous state of the application. For example, if you are paging through a set of movie records, you might return to the previous page of records. In an Ajax application, on the other hand, the browser backwards and forwards buttons do not work as you would expect. If you navigate to the second page in a list of records and click the backwards button, you won’t return to the previous page. Most likely, you will end up navigating away from the application entirely (which is very unexpected and irritating). Bookmarking presents a similar problem. You cannot bookmark a particular page of records in an Ajax application because the address bar does not reflect the state of the application. The Ajax Solution There is a solution to both of these problems. To solve both of these problems, you must take matters into your own hands and take responsibility for saving and restoring your application state yourself. Furthermore, you must ensure that the address bar gets updated to reflect the state of your application. In this blog entry, I demonstrate how you can take advantage of a jQuery library named bbq that enables you to control browser history (and make your Ajax application bookmarkable) in a cross-browser compatible way. The JavaScript Libraries In this blog entry, I take advantage of the following four JavaScript files: jQuery-1.4.2.js – The jQuery library. Available from the Microsoft Ajax CDN at http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.js jquery.pager.js – Used to generate pager for navigating records. Available from http://plugins.jquery.com/project/Pager microtemplates.js – John Resig’s micro-templating library. Available from http://ejohn.org/blog/javascript-micro-templating/ jquery.ba-bbq.js – The Back Button and Query (BBQ) Library. Available from http://benalman.com/projects/jquery-bbq-plugin/ All of these libraries, with the exception of the Micro-templating library, are available under the MIT open-source license. The Ajax Application Let’s start by building a simple Ajax application that enables you to page through a set of movie database records, 3 records at a time. We’ll use my favorite database named MoviesDB. This database contains a Movies table that looks like this: We’ll create a data model for this database by taking advantage of the ADO.NET Entity Framework. The data model looks like this: Finally, we’ll expose the data to the universe with the help of a WCF Data Service named MovieService.svc. The code for the data service is contained in Listing 1. Listing 1 – MovieService.svc using System.Data.Services; using System.Data.Services.Common; namespace WebApplication1 { public class MovieService : DataService<MoviesDBEntities> { public static void InitializeService(DataServiceConfiguration config) { config.SetEntitySetAccessRule("Movies", EntitySetRights.AllRead); config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2; } } } The WCF Data Service in Listing 1 exposes the movies so that you can query the movie database table with URLs that looks like this: http://localhost:2474/MovieService.svc/Movies -- Returns all movies http://localhost:2474/MovieService.svc/Movies?$top=5 – Returns 5 movies The HTML page in Listing 2 enables you to page through the set of movies retrieved from the WCF Data Service. Listing 2 – Original.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Movies with History</title> <link href="Design/Pager.css" rel="stylesheet" type="text/css" /> </head> <body> <h1>Page <span id="pageNumber"></span> of <span id="pageCount"></span></h1> <div id="pager"></div> <br style="clear:both" /><br /> <div id="moviesContainer"></div> <script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.js" type="text/javascript"></script> <script src="App_Scripts/Microtemplates.js" type="text/javascript"></script> <script src="App_Scripts/jquery.pager.js" type="text/javascript"></script> <script type="text/javascript"> var pageSize = 3, pageIndex = 0; // Show initial page of movies showMovies(); function showMovies() { // Build OData query var query = "/MovieService.svc" // base URL + "/Movies" // top-level resource + "?$skip=" + pageIndex * pageSize // skip records + "&$top=" + pageSize // take records + " &$inlinecount=allpages"; // include total count of movies // Make call to WCF Data Service $.ajax({ dataType: "json", url: query, success: showMoviesComplete }); } function showMoviesComplete(result) { // unwrap results var movies = result["d"]["results"]; var movieCount = result["d"]["__count"] // Show movies using template var showMovie = tmpl("<li><%=Id%> - <%=Title %></li>"); var html = ""; for (var i = 0; i < movies.length; i++) { html += showMovie(movies[i]); } $("#moviesContainer").html(html); // show pager $("#pager").pager({ pagenumber: (pageIndex + 1), pagecount: Math.ceil(movieCount / pageSize), buttonClickCallback: selectPage }); // Update page number and page count $("#pageNumber").text(pageIndex + 1); $("#pageCount").text(movieCount); } function selectPage(pageNumber) { pageIndex = pageNumber - 1; showMovies(); } </script> </body> </html> The page in Listing 3 has the following three functions: showMovies() – Performs an Ajax call against the WCF Data Service to retrieve a page of movies. showMoviesComplete() – When the Ajax call completes successfully, this function displays the movies by using a template. This function also renders the pager user interface. selectPage() – When you select a particular page by clicking on a page number in the pager UI, this function updates the current page index and calls the showMovies() function. Figure 1 illustrates what the page looks like when it is opened in a browser. Figure 1 If you click the page numbers then the browser history is not updated. Clicking the browser forward and backwards buttons won’t move you back and forth in browser history. Furthermore, the address displayed in the address bar does not change when you navigate to different pages. You cannot bookmark any page except for the first page. Adding Browser History The Back Button and Query (bbq) library enables you to add support for browser history and bookmarking to a jQuery application. The bbq library supports two important methods: jQuery.bbq.pushState(object) – Adds state to browser history. jQuery.bbq.getState(key) – Gets state from browser history. The bbq library also supports one important event: hashchange – This event is raised when the part of an address after the hash # is changed. The page in Listing 3 demonstrates how to use the bbq library to add support for browser navigation and bookmarking to an Ajax page. Listing 3 – Default.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Movies with History</title> <link href="Design/Pager.css" rel="stylesheet" type="text/css" /> </head> <body> <h1>Page <span id="pageNumber"></span> of <span id="pageCount"></span></h1> <div id="pager"></div> <br style="clear:both" /><br /> <div id="moviesContainer"></div> <script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.js" type="text/javascript"></script> <script src="App_Scripts/jquery.ba-bbq.js" type="text/javascript"></script> <script src="App_Scripts/Microtemplates.js" type="text/javascript"></script> <script src="App_Scripts/jquery.pager.js" type="text/javascript"></script> <script type="text/javascript"> var pageSize = 3, pageIndex = 0; $(window).bind('hashchange', function (e) { pageIndex = e.getState("pageIndex") || 0; pageIndex = parseInt(pageIndex); showMovies(); }); $(window).trigger('hashchange'); function showMovies() { // Build OData query var query = "/MovieService.svc" // base URL + "/Movies" // top-level resource + "?$skip=" + pageIndex * pageSize // skip records + "&$top=" + pageSize // take records +" &$inlinecount=allpages"; // include total count of movies // Make call to WCF Data Service $.ajax({ dataType: "json", url: query, success: showMoviesComplete }); } function showMoviesComplete(result) { // unwrap results var movies = result["d"]["results"]; var movieCount = result["d"]["__count"] // Show movies using template var showMovie = tmpl("<li><%=Id%> - <%=Title %></li>"); var html = ""; for (var i = 0; i < movies.length; i++) { html += showMovie(movies[i]); } $("#moviesContainer").html(html); // show pager $("#pager").pager({ pagenumber: (pageIndex + 1), pagecount: Math.ceil(movieCount / pageSize), buttonClickCallback: selectPage }); // Update page number and page count $("#pageNumber").text(pageIndex + 1); $("#pageCount").text(movieCount); } function selectPage(pageNumber) { pageIndex = pageNumber - 1; $.bbq.pushState({ pageIndex: pageIndex }); } </script> </body> </html> Notice the first chunk of JavaScript code in Listing 3: $(window).bind('hashchange', function (e) { pageIndex = e.getState("pageIndex") || 0; pageIndex = parseInt(pageIndex); showMovies(); }); $(window).trigger('hashchange'); When the hashchange event occurs, the current pageIndex is retrieved by calling the e.getState() method. The value is returned as a string and the value is cast to an integer by calling the JavaScript parseInt() function. Next, the showMovies() method is called to display the page of movies. The $(window).trigger() method is called to raise the hashchange event so that the initial page of records will be displayed. When you click a page number, the selectPage() method is invoked. This method adds the current page index to the address by calling the following method: $.bbq.pushState({ pageIndex: pageIndex }); For example, if you click on page number 2 then page index 1 is saved to the URL. The URL looks like this: Notice that when you click on page 2 then the browser address is updated to look like: /Default.htm#pageIndex=1 If you click on page 3 then the browser address is updated to look like: /Default.htm#pageIndex=2 Because the browser address is updated when you navigate to a new page number, the browser backwards and forwards button will work to navigate you backwards and forwards through the page numbers. When you click page 2, and click the backwards button, you will navigate back to page 1. Furthermore, you can bookmark a particular page of records. For example, if you bookmark the URL /Default.htm#pageIndex=1 then you will get the second page of records whenever you open the bookmark. Summary You should not avoid building Ajax applications because of worries concerning browser history or bookmarks. By taking advantage of a JavaScript library such as the bbq library, you can make your Ajax applications behave in exactly the same way as a normal web application.

    Read the article

  • How should I implement reverse AJAX in a Django application?

    - by Carson Myers
    How should I implement reverse AJAX when building a chat application in Django? I've looked at Django-Orbited, and from my understanding, this puts a comet server in front of the HTTP server. This seems fine if I'm just running the Django development server, but how does this work when I start running the application from mod_wsgi? How does having the orbited server handling every request scale? Is this the correct approach? I've looked at another approach (long polling) that seems like it would work, although I'm not sure what all would be involved. Would the client request a page that would live in its own thread, so as not to block the rest of the application? Would it even block? Wouldn't the script requested by the client have to continuously poll for information? Which of the approaches is more proper? Which is more portable, scalable, sane, etc? Are there other good approaches to this (aside from the client polling for messages) that I have overlooked?

    Read the article

  • fbjs ajax to load content

    - by fusion
    i tried one of the examples here to load the content in the div, but apart from displaying the image, it doesn't show anything. can anyone please point out where i'm going wrong? ajax1.js: function General_Refresh(url,div){ //Showing the load image (pay attention to /> of <img document.getElementById(div).setInnerXHTML('<span id="caric"><center><img src="http://website.name/images/ajax-loader.gif" /></center></span>'); var ajax = new Ajax(); ajax.responseType = Ajax.FBML; ajax.ondone = function(data) { //Hide the loading image document.getElementById('caric').setStyle('display','none'); document.getElementById(div).setInnerFBML(data); } //If there are errors re-try ajax.onerror = function() { General_Refresh(url,div); } ajax.post(url); } quote.html: <script src="http://website.name/scripts/ajax1.js" type="text/javascript"></script> <script type="text/javascript"> <!-- General_Refresh("http://website.name/quote.php","quote"); //--> </script> <div id="wrapper"> <div id="quote"><strong>this</strong></div> </div></div>

    Read the article

  • jQuery.ajax call to Twitter succeeds but returns null for Firefox

    - by Zhami
    I've got code that makes a simple get request to Twitter (search) using jQuery's ajax method. The code works fine on Safari, but fails on Firefox (3.6.3). In the Firefox case, my jQuery.ajax parameters 'success' method is invoked, but the supplied data is null. (In Safari, I receive a boatload of JSON data). My ajax call is: $.ajax({ url: 'http://search.twitter.com/search.json?q='+searchTerm, dataType: 'json', async: true, beforeSend: function(request) { window.console.log('starting AJAX request to get Twitter data'); }, success: function(data, textStatus, request) { window.console.log('AJAX request to get Twitter succeeded: status=' + textStatus); callback(data); }, error: function(request, status, error) { window.console.log('AJAX request to get user data --> Error: ' + status); errback(request, status, error); } }); Firebug shows Response headers: Date Sun, 11 Apr 2010 22:30:26 GMT Server hi Status 200 OK X-Served-From b021 X-Runtime 0.23841 Content-Type application/json; charset=utf-8 X-Served-By sjc1o024.prod.twitter.com X-Timeline-Cache-Hit Miss Cache-Control max-age=15, must-revalidate, max-age=300 Expires Sun, 11 Apr 2010 22:35:26 GMT Vary Accept-Encoding X-Varnish 1827846877 Age 0 Via 1.1 varnish X-Cache-Svr sjc1o024.prod.twitter.com X-Cache MISS Content-Encoding gzip Content-Length 2126 Connection close The HTTP status is OK (200), the Conetnt-Type is properly application/json, and the Content-Length of 2126 (gzip'd) implies data came back. Yet Firebug shows the Response to be empty, and a test of the supplied data shows it o be 'null.' I am aware of a similar post on Stack Overflow: http://stackoverflow.com/questions/1188976/jquery-get-function-succeeds-with-200-but-returns-no-content-in-firefox and from that would assume this problem is possibly related to cross-domain security, but... I know there are many JS widgets and whatnots that ajax get data from Twitter. Is there something I need to enable to allow this?

    Read the article

  • LGPL and Dual Licensing Ajax Library

    - by Thomas Hansen
    Hi guys, I'm the previous founder of Gaiaware and Gaia Ajax Widgets and when I used to work there we had this rhetoric (which I have confirmed with some very smart FOSS people is correct) that when using a GPL Ajax library you're basically "distributing" the JavaScript which in turn makes the GPL viral clause kick in and forces people to purchase a proprietary license if they're going to build Closed Source stuff... So now I'm the the LGPL world here with Ra-Ajax which is an LGPL licensed library and I've got no intentions of creating a GPL licensed library since I believe strongly in that the LGPL is the "enabler" of the Open Web to prevail. But something interesting have happened which I think might still give me a "business model" here which is the Linking clause of the LGPL which I think goes something like this (pseudo); "If you link to an LGPL licensed thing you get no restrictions on your own derived works"... But so we started creating something we're calling Ajax Starter-Kits which effectively is a "Project Kickstarter" where you can download a finished project/solution which basically enables you to start out with some pre-done boiler plate code for problems such as Ajax DataGrids, Ajax Calendar Applications, Ajax TreeView Applications etc. And the funny thing is that our users would NOT "link" to these, they would effectively BE our users applications... So to wrap up my question. Would this force users of our LGPL licensed Ajax Starter-Kits to LGPL license their own work? Basically if it does we have a business model (and I get very happy) if not I'd just have to hope people would still like to pay us those $29 for our Starter-Kits to support the project... ;) Help rewarded with extreme gratitude...

    Read the article

  • MS Ajax FilteredTextBox stopped working

    - by TenaciousImpy
    Hi, I'm using Microsoft's AJAX library via their CDN. Everything was going fine in an old project. I then created a new project and copied and pasted some of the AJAX code hoping that it would work. However, my code isn't working and I've been struggling to figure out why. I'm trying to implement a filtered textbox: <script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.js" type="text/javascript"></script> <script src="http://ajax.microsoft.com/ajax/beta/0911/Start.debug.js" type="text/javascript"></script> <script src="http://ajax.microsoft.com/ajax/beta/0911/extended/ExtendedControls.debug.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { Sys.require(Sys.components.filteredTextBox, function() { $("[id$='UserName']").filteredTextBox({ InvalidChars: ".", FilterType: Sys.Extended.UI.FilterTypes.Numbers | Sys.Extended.UI.FilterTypes.UppercaseLetters | Sys.Extended.UI.FilterTypes.LowercaseLetters | Sys.Extended.UI.FilterTypes.Custom, FilterMode: Sys.Extended.UI.FilterModes.ValidChars }); }); }); </script> When I run this, the textbox isn't filtered and I can enter any character. In Chrome, I used the Dev Tools and it found two errors on the page. In my .aspx page, I have: Uncaught TypeError: Cannot read property 'Numbers' of undefined (regarding the Sys.Extended.UI.FilterTypes.Numbers in the code above). In filteredtextboxbehavior.debug.js, I have the error: Uncaught TypeError: Object #<an Object> has no method 'registerComponent' Any ideas why I'm getting this error? The code has been working previously so I'm not sure if I had added any extra settings in my old project which the new one doesn't have. Thanks! ps:The textbox can be found as any other actions on it are recognized.

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >