Search Results

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

Page 4/323 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Web Application: Combining View Layer Between PHP and Javascript-AJAX

    - by wlz
    I'm developing web application using PHP with CodeIgniter MVC framework with a huge real time client-side functionality needs. This is my first time to build large scale of client-side app. So I combine the PHP with a large scale of Javascript modules in one project. As you already know, MVC framework seperate application modules into Model-View-Controller. My concern is about View layer. I could be display the data on the DOM by PHP built-in script tag by load some data on the Controller. Otherwise I could use AJAX to pulled the data -- treat the Controller like a service only -- and display the them by Javascript. Here is some visualization I could put the data directly from Controller: <label>Username</label> <input type="text" id="username" value="<?=$userData['username'];?>"><br /> <label>Date of birth</label> <input type="text" id="dob" value="<?=$userData['dob'];?>"><br /> <label>Address</label> <input type="text" id="address" value="<?=$userData['address'];?>"> Or pull them using AJAX: $.ajax({ type: "POST", url: config.indexURL + "user", dataType: "json", success: function(data) { $('#username').val(data.username); $('#dateOfBirth').val(data.dob); $('#address').val(data.address); } }); So, which approach is better regarding my application has a complex client-side functionality? In the other hand, PHP-CI has a default mechanism to put the data directly from Controller, so why using AJAX?

    Read the article

  • what receives an ajax call?

    - by jbcolmenares
    I'm making a site which should (a) take information from the user in the form of files and forms, (b) take that data to the server to be run on a C application, and (c) take the result back and show it to the user. I was told to look for AJAX for the communication with the server. BTW, I'm using rails. I'm trying to understand how AJAX works. From what I understand so far, with rails is pretty easy to make the call. What I can't figure out is, what waits for that call? what process the call? If I understand correctly, with rails I could make a function in ruby and make it so it's called through AJAX, which means -or so I understand- that it gets executed on the server. If I were using PHP, would I need to make an http server to wait for the AJAX calls? I just don't find information about what waits for the call, and that information is processed. Any links, comments or books are welcome!

    Read the article

  • Ajax comments form in ASP.NET MVC2

    - by Artiom Chilaru
    I've been playing around with different aspects of MVC for some time now, and I've reached a situation where I'm not sure what would be the best way to solve a problem. I'm hoping that the SO community will help me out here :P I've seen a number of examples of Ajax.BeginForm on the internet, and it seems like a very nifty idea. E.g. you have a dropdown where you select a customer - and on selecting one it will load this client's details in some placeholder on the page. This works perfectly fine. But what to do if you want to tie in some validation in the box? Just hypothetically, imagine an article page, and user comments in the bottom. Below the comments area there's an ajax-y "Add comment" box. When a user adds a comment, it will appear in the comments area, below the last comment there. If I set the Ajax.BeginForm to Append the result of the call to the Comments area, it will work fine. But what if the data posted is not valid? Instead of appending a "successful" comment to the comments area I have to show the user validation errors. At this point I decided that the area INSIDE the Ajax.BeginForm will be inside a partial, and the form's submits will return this partial. Validation works fine. On each submit we reload the contents inside the form element. But how to add the successful comment to the top? Other things to consider: The comment form also has a "Preview" button. When the user clicks on Preview, I should load the rendered comment into a preview box. This will probably be inside the form area as well. I was thinking of using Json results instead. When the user submits the form, the server code will generate a Json object with a Success value, and html rendered partials as some properties. Something like { "success": true, "form": "<html form data>", "comment": "successful comment html to inject into the page" } This would be a perfect solution, except there's no way in MVC to render a partial into a string, inside the controller (separation of context, remember?). So.. what should I do then? Any "correct" way to implement this?

    Read the article

  • Ajax comments form in ASP.NET MVC2, howto?

    - by Artiom Chilaru
    I've been playing around with different aspects of MVC for some time now, and I've reached a situation where I'm not sure what would be the best way to solve a problem. I'm hoping that the SO community will help me out here :P I've seen a number of examples of Ajax.BeginForm on the internet, and it seems like a very nifty idea. E.g. you have a dropdown where you select a customer - and on selecting one it will load this client's details in some placeholder on the page. This works perfectly fine. But what to do if you want to tie in some validation in the box? Just hypothetically, imagine an article page, and user comments in the bottom. Below the comments area there's an ajax-y "Add comment" box. When a user adds a comment, it will appear in the comments area, below the last comment there. If I set the Ajax.BeginForm to Append the result of the call to the Comments area, it will work fine. But what if the data posted is not valid? Instead of appending a "successful" comment to the comments area I have to show the user validation errors. At this point I decided that the area INSIDE the Ajax.BeginForm will be inside a partial, and the form's submits will return this partial. Validation works fine. On each submit we reload the contents inside the form element. But how to add the successful comment to the top? Other things to consider: The comment form also has a "Preview" button. When the user clicks on Preview, I should load the rendered comment into a preview box. This will probably be inside the form area as well. I was thinking of using Json results instead. When the user submits the form, the server code will generate a Json object with a Success value, and html rendered partials as some properties. Something like { "success": true, "form": "<html form data>", "comment": "successful comment html to inject into the page" } This would be a perfect solution, except there's no way in MVC to render a partial into a string, inside the controller (separation of context, remember?). So.. what should I do then? Any "correct" way to implement this? Anyone???

    Read the article

  • UTF8 encoding not working when using ajax.

    - by Ronedog
    I recently changed some of my pages to be displayed via ajax and I am having some confusion as to why the utf8 encoding is now displaying a question mark inside of a box, whereas before it wasn't. Fore example. The oringal page was index.php. charset was explicitly set to utf8 and is in the <head>. I then used php to query the database Heres is the original index.php page: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Title here</title> </head> <body class='body_bgcolor' > <div id="main_container"> <?php Data displayed via php was simply a select statement that output the HTML. ?> </div> However, when I made the change to add a menu that populated the "main_container" via ajax all the utf8 encoding stopped working. Here's the new code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Title here</title> </head> <body class='body_bgcolor' > <a href="#" onclick="display_html('about_us');"> About Us </a> <div id="main_container"></div> The "display_html()" function calls the javascript page which uses jquery ajax call to retrieve the html stored inside a php page, then places the html inside the div with an id of "main_container". I'm setting the charset in jquery to be utf8 like: $.ajax({ async: false, type: "GET", url: url, contentType: "charset=utf-8", success: function(data) { $("#main_container").html(data); } }); What am I doing wrong?

    Read the article

  • Is it worth learning ASP.Net AJAX

    - by Yogendra
    Hi All, I know this is a duplicate kind of question. I have worked with ASP.Net and ASP.Net MVC 1.0. I never really got a chance to get into ASP.Net AJAX. My question is it really worth to invest in learning ASP.Net AJAX 3.5 or 4.0 given the fact, I have hardly used it ? Please let me know your advise.

    Read the article

  • Get variables in c# from ajax call

    - by fzshah76
    I've got an Ajax call for log in here is the code: //if MOUSE class is clicked $('.mouse').click(function () { //get the form to submit and return a message //how to call the function var name = $('#name').val(); var pwd2 = $('#pwd2').val(); $.ajax({ type:"POST", url: "http://localhost:51870/code/Login.aspx", data: "{ 'name':'" + $('#name').val() + "', 'pwd':'" + $('#pwd2').val() + "' }", contentType: "application/json; charset=utf-8", dataType: "json", context: document.body, success: function () { //$(this).addClass("done"); $(this).hide(); $('.mouse, .window').hide(); } }); }); the problem is I can't seem to catch name and pwd variables in Login page's preinit event or page load event here is the code in c#: protected void Page_PreInit(object sender, EventArgs e) { //taking javascript argument in preinit event //from here I'll have to build the page for specific lookbook var name = Request.QueryString["name"]; var pwd = Request.QueryString["pwd"]; } protected void Page_Load(object sender, EventArgs e) { var name = Request.QueryString["name"]; var pwd = Request.QueryString["pwd"]; SignIn(name); } I can't seem to get username name and password in c# side, help is appreciated. Here is my final javascript code c# code remains the same: <script type="text/javascript"> $(document).ready(function () { //if MOUSE class is clicked $('.mouse').click(function () { var name = $('#name').val(); var pwd = $('#pwd').val(); $.ajax({ url: "http://localhost:51870/code/Login.aspx?name="+ name +"&pwd="+pwd, context: document.body, success: function () { //$(this).addClass("done"); $(this).hide(); $('.mouse, .window').hide(); } }); }); }); </script> Thanks Zachary

    Read the article

  • My AJAX is only firing once,

    - by sea_1987
    Hi There, I ahave some ajax that is fired when a checkbox is clicked, it essentially sends a query string to a PHP script and then returns the relevant HTML, however, if I select a select it works fine if I then slect another checkbox as well as the previous I get no activity what so ever, not even any errors in firebug, it is very curious, does anyone have any ideas? //Location AJAX //var dataObject = new Object(); var selected = new Array(); //alert(selected); $('#areas input.radio').change(function(){ // will trigger when the checked status changes var checked = $(this).attr("checked"); // will return "checked" or false I think. // Do whatever request you like with the checked status if(checked == true) { //selected.join('&'); selected = $('input:checked').map(function() { return $(this).attr('name')+"="+$(this).val(); }).get(); getQuery = selected.join('&')+"&location_submit=Next"; alert(getQuery); $.ajax({ type:"POST", url:"/search/location", data: getQuery, success:function(data){ //alert(getQuery); //console.log(data); $('body.secEmp').html(data); } }); } else { //do something to remove the content here alert($(this).attr('name')); } });

    Read the article

  • ASP.NET Ajax - Asynch request has separate session???

    - by Marcus King
    We are writing a search application that saves the search criteria to session state and executes the search inside of an asp.net updatepanel. Sometimes when we execute multiple searches successively the 2nd or 3rd search will sometimes return results from the first set of search criteria. Example: our first search we do a look up on "John Smith" - John Smith results are displayed. The second search we do a look up on "Bob Jones" - John Smith results are displayed. We save all of the search criteria in session state as I said, and read it from session state inside of the ajax request to format the DB query. When we put break points in VS everything behaves as normal, but without them we get the original search criteria and results. My guess is because they are saved in session, that the ajax request somehow gets its own session and saves the criteria to that, and then retrieves the criteria from that session every time, but the non-async stuff is able to see when the criteria is modified and saves the changes to state accordingly, but because they are from two different sessions there is a disparity in what is saved and read. EDIT::: To elaborate more, there was a suggestion of appending the search criteria to the query string which normally is good practice and I agree thats how it should be but following our requirements I don't see it as being viable. They want it so the user fills out the input controls hits search and there is no page reload, the only thing they see is a progress indicator on the page, and they still have the ability to navigate and use other features on the current page. If I were to add criteria to the query string I would have to do another request causing the whole page to load, which depending on the search criteria can take a really long time. This is why we are using an ajax call to perform the search and why we aren't causing another full page request..... I hope this clarifies the situation.

    Read the article

  • MS Ajax Libraries and Configured Assemblies

    - by smehaffie
    Use Case You have a brand new IIS servers that has .Net 3.5 installed and are migrating sites to the new servers.  In the process of migrating sites you come across some sites that get an error about the version of AJAX libraries being references in the web.config.  In the web.config all the entries reference 1.0.61025.0, but the older version of the AJAX libraries are not installed on the new servers, only the latest version is installed that comes with .Net 3.5.  So what are the options to fix this issue. Solutions 1) Install the older version of the AJAX Libraries: Although this works, IMO it is never a great idea to install an older version of a library after a newer version has been installed.  Plus, if all new application use the latest versions, is it worth the effort of installing the older version for a few legacy applications? 2) Update the web.config files so all references use latest version (3.5.0.0):  This option is very time consuming and error prone. In addition, you will also have to update any pages where there is a register tag for the older libraries as well.  This would require you to redeploy any application that have this issue. 3) Use the Configured Assembly capabilities of .Net (aka: Assembly Bindings) to make any application that uses the older AJAX libraries to use the new AJAX libraries.  IMO, this is the easiest, quickest and least invasive way to fix the issue.  Below are the steps to implement this fix. Solution #3 Do the following steps on the IIS servers that the issue is occurring.  The 2 assemblies that need assemblies bindings created are: System.Web.Extension & System.Web.Extensions.Design 1) Go to Start - > All Program -> Administrative Tools -> Microsoft .NET Framework 2.0 Configuration. 2) Right click on "Configured Assemblies" to view list of configured assemblies. 3) Left Click on right pane to bring up menu and choose "Add". 4) Make sure "Choose and assembly from the assembly cache is checked" and click the "Choose Assembly" button. 5) Choose System.Web.Extension (does not matter what version). 6) Click the "Finish" button. 7) Binding Policy Tab      - Enter Requested Version = 1.0.61025.0      - Enter New Version = 3.5.0.0 8) Repeat steps 2-7 for the System.Web.Extensions.Design assembly. --------------------------------------------------------------------------------------------------------------------------------------------------------- Note: If "Microsoft .NET Framework 2.0 Configuration does not exist under Admin tools use mmc to access it (see below) 1) Start -> Run -> Enter MMC 2) File - > Add/Remove Snap-In then Click "Add" button 3) Choose ".Net 2.0 Configuration" then click "Add" button and then the "Close" Button. 4) On "Add/Remove Snapin" windows click the "OK" Button. 5) Expand the tree on the right and you can start following the directions above for adding the configured assemblies. ---------------------------------------------------------------------------------------------------------------------------------------------------------

    Read the article

  • ajax : multiple ajax calls for included js files inside jsp fragment

    - by Nrj
    I am including a jsp fragment by making an ajax call. Now this jsp frag happened to include several js files. When the ajax request is completed, it is loading each of the included js files (on fragments) using a separate get request. (I checked this using firebug.) Now is this the correct behavior (making separate get calls) or am I missing something. Is there a way to include the js files and send the response in one go ?

    Read the article

  • Anti-Forgery Request Recipes For ASP.NET MVC And AJAX

    - by Dixin
    Background To secure websites from cross-site request forgery (CSRF, or XSRF) attack, ASP.NET MVC provides an excellent mechanism: The server prints tokens to cookie and inside the form; When the form is submitted to server, token in cookie and token inside the form are sent in the HTTP request; Server validates the tokens. To print tokens to browser, just invoke HtmlHelper.AntiForgeryToken():<% using (Html.BeginForm()) { %> <%: this.Html.AntiForgeryToken(Constants.AntiForgeryTokenSalt)%> <%-- Other fields. --%> <input type="submit" value="Submit" /> <% } %> This invocation generates a token then writes inside the form:<form action="..." method="post"> <input name="__RequestVerificationToken" type="hidden" value="J56khgCvbE3bVcsCSZkNVuH9Cclm9SSIT/ywruFsXEgmV8CL2eW5C/gGsQUf/YuP" /> <!-- Other fields. --> <input type="submit" value="Submit" /> </form> and also writes into the cookie: __RequestVerificationToken_Lw__= J56khgCvbE3bVcsCSZkNVuH9Cclm9SSIT/ywruFsXEgmV8CL2eW5C/gGsQUf/YuP When the above form is submitted, they are both sent to server. In the server side, [ValidateAntiForgeryToken] attribute is used to specify the controllers or actions to validate them:[HttpPost] [ValidateAntiForgeryToken(Salt = Constants.AntiForgeryTokenSalt)] public ActionResult Action(/* ... */) { // ... } This is very productive for form scenarios. But recently, when resolving security vulnerabilities for Web products, some problems are encountered. Specify validation on controller (not on each action) The server side problem is, It is expected to declare [ValidateAntiForgeryToken] on controller, but actually it has be to declared on each POST actions. Because POST actions are usually much more then controllers, the work would be a little crazy. Problem Usually a controller contains actions for HTTP GET and actions for HTTP POST requests, and usually validations are expected for HTTP POST requests. So, if the [ValidateAntiForgeryToken] is declared on the controller, the HTTP GET requests become invalid:[ValidateAntiForgeryToken(Salt = Constants.AntiForgeryTokenSalt)] public class SomeController : Controller // One [ValidateAntiForgeryToken] attribute. { [HttpGet] public ActionResult Index() // Index() cannot work. { // ... } [HttpPost] public ActionResult PostAction1(/* ... */) { // ... } [HttpPost] public ActionResult PostAction2(/* ... */) { // ... } // ... } If browser sends an HTTP GET request by clicking a link: http://Site/Some/Index, validation definitely fails, because no token is provided. So the result is, [ValidateAntiForgeryToken] attribute must be distributed to each POST action:public class SomeController : Controller // Many [ValidateAntiForgeryToken] attributes. { [HttpGet] public ActionResult Index() // Works. { // ... } [HttpPost] [ValidateAntiForgeryToken(Salt = Constants.AntiForgeryTokenSalt)] public ActionResult PostAction1(/* ... */) { // ... } [HttpPost] [ValidateAntiForgeryToken(Salt = Constants.AntiForgeryTokenSalt)] public ActionResult PostAction2(/* ... */) { // ... } // ... } This is a little bit crazy, because one application can have a lot of POST actions. Solution To avoid a large number of [ValidateAntiForgeryToken] attributes (one for each POST action), the following ValidateAntiForgeryTokenWrapperAttribute wrapper class can be helpful, where HTTP verbs can be specified:[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] public class ValidateAntiForgeryTokenWrapperAttribute : FilterAttribute, IAuthorizationFilter { private readonly ValidateAntiForgeryTokenAttribute _validator; private readonly AcceptVerbsAttribute _verbs; public ValidateAntiForgeryTokenWrapperAttribute(HttpVerbs verbs) : this(verbs, null) { } public ValidateAntiForgeryTokenWrapperAttribute(HttpVerbs verbs, string salt) { this._verbs = new AcceptVerbsAttribute(verbs); this._validator = new ValidateAntiForgeryTokenAttribute() { Salt = salt }; } public void OnAuthorization(AuthorizationContext filterContext) { string httpMethodOverride = filterContext.HttpContext.Request.GetHttpMethodOverride(); if (this._verbs.Verbs.Contains(httpMethodOverride, StringComparer.OrdinalIgnoreCase)) { this._validator.OnAuthorization(filterContext); } } } When this attribute is declared on controller, only HTTP requests with the specified verbs are validated:[ValidateAntiForgeryTokenWrapper(HttpVerbs.Post, Constants.AntiForgeryTokenSalt)] public class SomeController : Controller { // GET actions are not affected. // Only HTTP POST requests are validated. } Now one single attribute on controller turns on validation for all POST actions. Maybe it would be nice if HTTP verbs can be specified on the built-in [ValidateAntiForgeryToken] attribute, which is easy to implemented. Specify Non-constant salt in runtime By default, the salt should be a compile time constant, so it can be used for the [ValidateAntiForgeryToken] or [ValidateAntiForgeryTokenWrapper] attribute. Problem One Web product might be sold to many clients. If a constant salt is evaluated in compile time, after the product is built and deployed to many clients, they all have the same salt. Of course, clients do not like this. Even some clients might want to specify a custom salt in configuration. In these scenarios, salt is required to be a runtime value. Solution In the above [ValidateAntiForgeryToken] and [ValidateAntiForgeryTokenWrapper] attribute, the salt is passed through constructor. So one solution is to remove this parameter:public class ValidateAntiForgeryTokenWrapperAttribute : FilterAttribute, IAuthorizationFilter { public ValidateAntiForgeryTokenWrapperAttribute(HttpVerbs verbs) { this._verbs = new AcceptVerbsAttribute(verbs); this._validator = new ValidateAntiForgeryTokenAttribute() { Salt = AntiForgeryToken.Value }; } // Other members. } But here the injected dependency becomes a hard dependency. So the other solution is moving validation code into controller to work around the limitation of attributes:public abstract class AntiForgeryControllerBase : Controller { private readonly ValidateAntiForgeryTokenAttribute _validator; private readonly AcceptVerbsAttribute _verbs; protected AntiForgeryControllerBase(HttpVerbs verbs, string salt) { this._verbs = new AcceptVerbsAttribute(verbs); this._validator = new ValidateAntiForgeryTokenAttribute() { Salt = salt }; } protected override void OnAuthorization(AuthorizationContext filterContext) { base.OnAuthorization(filterContext); string httpMethodOverride = filterContext.HttpContext.Request.GetHttpMethodOverride(); if (this._verbs.Verbs.Contains(httpMethodOverride, StringComparer.OrdinalIgnoreCase)) { this._validator.OnAuthorization(filterContext); } } } Then make controller classes inheriting from this AntiForgeryControllerBase class. Now the salt is no long required to be a compile time constant. Submit token via AJAX For browser side, once server side turns on anti-forgery validation for HTTP POST, all AJAX POST requests will fail by default. Problem In AJAX scenarios, the HTTP POST request is not sent by form. Take jQuery as an example:$.post(url, { productName: "Tofu", categoryId: 1 // Token is not posted. }, callback); This kind of AJAX POST requests will always be invalid, because server side code cannot see the token in the posted data. Solution Basically, the tokens must be printed to browser then sent back to server. So first of all, HtmlHelper.AntiForgeryToken() need to be called somewhere. Now the browser has token in both HTML and cookie. Then jQuery must find the printed token in the HTML, and append token to the data before sending:$.post(url, { productName: "Tofu", categoryId: 1, __RequestVerificationToken: getToken() // Token is posted. }, callback); To be reusable, this can be encapsulated into a tiny jQuery plugin:/// <reference path="jquery-1.4.2.js" /> (function ($) { $.getAntiForgeryToken = function (tokenWindow, appPath) { // HtmlHelper.AntiForgeryToken() must be invoked to print the token. tokenWindow = tokenWindow && typeof tokenWindow === typeof window ? tokenWindow : window; appPath = appPath && typeof appPath === "string" ? "_" + appPath.toString() : ""; // The name attribute is either __RequestVerificationToken, // or __RequestVerificationToken_{appPath}. tokenName = "__RequestVerificationToken" + appPath; // Finds the <input type="hidden" name={tokenName} value="..." /> from the specified. // var inputElements = $("input[type='hidden'][name='__RequestVerificationToken" + appPath + "']"); var inputElements = tokenWindow.document.getElementsByTagName("input"); for (var i = 0; i < inputElements.length; i++) { var inputElement = inputElements[i]; if (inputElement.type === "hidden" && inputElement.name === tokenName) { return { name: tokenName, value: inputElement.value }; } } return null; }; $.appendAntiForgeryToken = function (data, token) { // Converts data if not already a string. if (data && typeof data !== "string") { data = $.param(data); } // Gets token from current window by default. token = token ? token : $.getAntiForgeryToken(); // $.getAntiForgeryToken(window). data = data ? data + "&" : ""; // If token exists, appends {token.name}={token.value} to data. return token ? data + encodeURIComponent(token.name) + "=" + encodeURIComponent(token.value) : data; }; // Wraps $.post(url, data, callback, type). $.postAntiForgery = function (url, data, callback, type) { return $.post(url, $.appendAntiForgeryToken(data), callback, type); }; // Wraps $.ajax(settings). $.ajaxAntiForgery = function (settings) { settings.data = $.appendAntiForgeryToken(settings.data); return $.ajax(settings); }; })(jQuery); In most of the scenarios, it is Ok to just replace $.post() invocation with $.postAntiForgery(), and replace $.ajax() with $.ajaxAntiForgery():$.postAntiForgery(url, { productName: "Tofu", categoryId: 1 }, callback); // Token is posted. There might be some scenarios of custom token, where $.appendAntiForgeryToken() is useful:data = $.appendAntiForgeryToken(data, token); // Token is already in data. No need to invoke $.postAntiForgery(). $.post(url, data, callback); And there are scenarios that the token is not in the current window. For example, an HTTP POST request can be sent by an iframe, while the token is in the parent window. Here, token's container window can be specified for $.getAntiForgeryToken():data = $.appendAntiForgeryToken(data, $.getAntiForgeryToken(window.parent)); // Token is already in data. No need to invoke $.postAntiForgery(). $.post(url, data, callback); If you have better solution, please do tell me.

    Read the article

  • Ajax Control Toolkit November 2011 Release

    - by Stephen Walther
    I’m happy to announce the November 2011 Release of the Ajax Control Toolkit. This release introduces a new Balloon Popup control and several enhancements to the existing Tabs control including support for on-demand loading of tab content, support for vertical tabs, and support for keyboard tab navigation. We also fixed the top-voted bugs associated with the Tabs control reported at CodePlex.com. You can download the new release by visiting the CodePlex website: http://AjaxControlToolkit.CodePlex.com Alternatively, the fast and easy way to get the latest release of the Ajax Control Toolkit is to use NuGet. Open your Library Package Manager console in Visual Studio 2010 and type: After you install the Ajax Control Toolkit through NuGet, please do a Rebuild of your project (the menu option Build, Rebuild). After you do a Rebuild, the ajaxToolkit prefix will appear in Intellisense: Using the Balloon Popup Control Why a new Balloon Popup control? The Balloon Popup control is the second most requested new feature for the Ajax Control Toolkit according to CodePlex votes: The Balloon Popup displays a message in a balloon when you shift focus to a control, click a control, or hover over a control. You can use the Balloon Popup, for example, to display instructions for TextBoxes which appear in a form: Here’s the code used to create the Balloon Popup: <ajaxToolkit:ToolkitScriptManager ID="tsm1" runat="server" /> <asp:TextBox ID="txtFirstName" Runat="server" /> <asp:Panel ID="pnlFirstNameHelp" runat="server"> Please enter your first name </asp:Panel> <ajaxToolkit:BalloonPopupExtender TargetControlID="txtFirstName" BalloonPopupControlID="pnlFirstNameHelp" BalloonSize="Small" UseShadow="true" runat="server" /> You also can use the Balloon Popup to explain hard to understand words in a text document: Here’s how you display the Balloon Popup when you hover over the link: The point of the conversation was <asp:HyperLink ID="lnkObfuscate" Text="obfuscated" CssClass="hardWord" runat="server" /> by his incessant coughing. <ajaxToolkit:ToolkitScriptManager ID="tsm1" runat="server" /> <asp:Panel id="pnlObfuscate" Runat="server"> To bewilder or render something obscure </asp:Panel> <ajaxToolkit:BalloonPopupExtender TargetControlID="lnkObfuscate" BalloonPopupControlID="pnlObfuscate" BalloonStyle="Cloud" UseShadow="true" DisplayOnMouseOver="true" Runat="server" />   There are four important properties which you need to know about when using the Balloon Popup control: BalloonSize – The three balloon sizes are Small, Medium, and Large. BalloonStyle -- The two built-in styles are Rectangle and Cloud. UseShadow – When true, a drop shadow appears behind the popup. Position – Can have the values Auto, BottomLeft, BottomRight, TopLeft, TopRight. When set to Auto, which is the default, the Balloon Popup will appear where it has the most screen real estate. The following screenshots illustrates how these settings affect the appearance of the Balloon Popup: Customizing the Balloon Popup You can customize the appearance of the Balloon Popup by creating your own Cascading Style Sheet and Sprite. The Ajax Control Toolkit sample site includes a sample of a custom Oval Balloon Popup style: This custom style was created by using a custom Cascading Style Sheet and image. You point the Balloon Popup at a custom Cascading Style Sheet and Cascading Style Sheet class by using the CustomCssUrl and CustomClassName properties like this: <asp:TextBox ID="txtCustom" autocomplete="off" runat="server" /> <br /> <asp:Panel ID="Panel3" runat="server"> This is a custom BalloonPopupExtender style created with a custom Cascading Style Sheet. </asp:Panel> <ajaxToolkit:BalloonPopupExtender ID="bpe1" TargetControlID="txtCustom" BalloonPopupControlID="Panel3" BalloonStyle="Custom" CustomCssUrl="CustomStyle/BalloonPopupOvalStyle.css" CustomClassName="oval" UseShadow="true" runat="server" />   Learn More about the Balloon Popup To learn more about the Balloon Popup control, visit the sample page for the Balloon Popup at the Ajax Control Toolkit sample site: http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/BalloonPopup/BalloonPopupExtender.aspx Improvements to the Tabs Control In this release, we introduced several important new features for the existing Tabs control. We also fixed all of the top-voted bugs for the Tabs control. On-Demand Loading of Tab Content Here is the scenario. Imagine that you are using the Tabs control in a Web Forms page. The Tabs control displays two tabs: Customers and Products. When you click the Customers tab then you want to see a list of customers and when you click on the Products tab then you want to see a list of products. In this scenario, you don’t want the list of customers and products to be retrieved from the database when the page is initially opened. The user might never click on the Products tab and all of the work to load the list of products from the database would be wasted. In this scenario, you want the content of a tab panel to be loaded on demand. The products should only be loaded from the database and rendered to the browser when you click the Products tab and not before. The Tabs control in the November 2011 Release of the Ajax Control Toolkit includes a new property named OnDemand. When OnDemand is set to the value True, a tab panel won’t be loaded until you click its associated tab. Here is the code for the aspx page: <ajaxToolkit:ToolkitScriptManager ID="tsm1" runat="server" /> <ajaxToolkit:TabContainer ID="tabs" OnDemand="false" runat="server"> <ajaxToolkit:TabPanel HeaderText="Customers" runat="server"> <ContentTemplate> <h2>Customers</h2> <asp:GridView ID="grdCustomers" DataSourceID="srcCustomers" runat="server" /> <asp:SqlDataSource ID="srcCustomers" SelectCommand="SELECT * FROM Customers" ConnectionString="<%$ ConnectionStrings:StoreDB %>" runat="server" /> </ContentTemplate> </ajaxToolkit:TabPanel> <ajaxToolkit:TabPanel HeaderText="Products" runat="server"> <ContentTemplate> <h2>Products</h2> <asp:GridView ID="grdProducts" DataSourceID="srcProducts" runat="server" /> <asp:SqlDataSource ID="srcProducts" SelectCommand="SELECT * FROM Products" ConnectionString="<%$ ConnectionStrings:StoreDB %>" runat="server" /> </ContentTemplate> </ajaxToolkit:TabPanel> </ajaxToolkit:TabContainer> Notice that the TabContainer includes an OnDemand=”True” property. The Tabs control contains two Tab Panels. The first tab panel uses a DataGrid and SqlDataSource to display a list of customers and the second tab panel uses a DataGrid and SqlDataSource to display a list of products. And here is the code-behind for the page: using System; using System.Diagnostics; using System.Web.UI.WebControls; namespace ACTSamples { public partial class TabsOnDemand : System.Web.UI.Page { protected override void OnInit(EventArgs e) { srcProducts.Selecting += new SqlDataSourceSelectingEventHandler(srcProducts_Selecting); } void srcProducts_Selecting(object sender, SqlDataSourceSelectingEventArgs e) { Debugger.Break(); } } } The code-behind file includes an event handler for the Products SqlDataSource Selecting event. The handler breaks into the debugger by calling the Debugger.Break() method. That way, we can know when the Products SqlDataSource actually retrieves the list of products. When the OnDemand property has the value False then the Selecting event handler is called immediately when the page is first loaded. The contents of all of the tabs are loaded (and the contents of the unselected tabs are hidden) when the page is first loaded. When the OnDemand property has the value True then the Selecting event handler is not called when the page is first loaded. The event handler is not called until you click on the Products tab. If you never click on the Products tab then the list of products is never retrieved from the database. If you want even more control over when the contents of a tab panel gets loaded then you can use the TabPanel OnDemandMode property. This property accepts the following three values: None – Never load the contents of the tab panel again after the page is first loaded. Once – Wait until the tab is selected to load the contents of the tab panel Always – Load the contents of the tab panel each and every time you select the tab. There is a live demonstration of the OnDemandMode property here in the sample page for the Tabs control: http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/Tabs/Tabs.aspx Displaying Vertical Tabs With the November 2011 Release, the Tabs control now supports vertical tabs. To create vertical tabs, just set the TabContainer UserVerticalStripPlacement property to the value True like this: <ajaxToolkit:TabContainer ID="tabs" OnDemand="false" UseVerticalStripPlacement="true" runat="server"> <ajaxToolkit:TabPanel ID="TabPanel1" HeaderText="First Tab" runat="server"> <ContentTemplate> <p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna. </p> </ContentTemplate> </ajaxToolkit:TabPanel> <ajaxToolkit:TabPanel ID="TabPanel2" HeaderText="Second Tab" runat="server"> <ContentTemplate> <p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna. </p> </ContentTemplate> </ajaxToolkit:TabPanel> </ajaxToolkit:TabContainer> In addition, you can use the TabStripPlacement property to control whether the tab strip appears at the left or right or top or bottom of the tab panels: Tab Keyboard Navigation Another highly requested feature for the Tabs control is support for keyboard navigation. The Tabs control now supports the arrow keys and the Home and End keys. In order for the arrow keys to work, you must first move focus to the tab control on the page by either clicking on a tab with your mouse or repeatedly hitting the Tab key. You can try out the new keyboard navigation support by trying any of the demos included in the Tabs sample page: http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/Tabs/Tabs.aspx Summary I hope that you take advantage of the new Balloon Popup control and the new features which we introduced for the Tabs control. We added a lot of new features to the Tabs control in this release including support for on-demand tabs, support for vertical tabs, and support for tab keyboard navigation. I want to thank the developers on the Superexpert team for all of the hard work which they put into this release.

    Read the article

  • Installing Ajax Control Toolkit in Visual Studio 2010

    - by nannette
    I needed to install the Ajax Control Toolkit for Visual Studio 2010 4.0 Framework, so I googled "install ajax control toolkit visual studio 2010" and found this step by step guide: http://www.asp.net/ajaxlibrary/act.ashx It installed perfectly for me the first time, so I'd recommend following the above link. There were just a few steps and voila! I'm including this link here, because a in February 2008, I posted a blog for installing the toolkit in Visual Web Developer. http://weblogs.asp.net/nannettethacker...(read more)

    Read the article

  • JSF 2.0 AJAX: jsf.ajax.request to call method not only rerender an area of page

    - by gerry
    Hi, I'm looking for a soultion of the following problem: _The is a list of links with different types of cars. _The user can click on each car in the list and a ajax request should be sent. _The response of the ajax request should be dependent on the id (of each car) and displayed in an panelGroup. So what I need is a possibility to call a method on the backing-bean. Additionally, this method should be called with a car id as its parameter. My code so far looks like: ... <ul> <ui:repeat value="#{carTree.getCars)}" var="car"> <h:outputScript name="jsf.js" library="javax.faces" target="head" /> <li onclick="showDetails(#{car.id});">#{car.name}</li> </ui:repeat> </ul> ... <h:panelGroup id="carDetails" layout="block" style="float:left;"> // need the details of each 'selected /clicked' car here </h:panelGroup> ... And the method in the backing bean should look like: public class CarTree { ... public String getCarDetails(int carid){ return "The car details for the car id "+carid+" are......"; } ... } I've no idea how to call a method by using the new JSF 2.0 AJAX functionality. Please, help me...

    Read the article

  • Return automatic download JQuery Ajax Call

    - by krio
    I use the Ajax JQuery command to call a PHP script that generates a CSV file and returns a link to that file for the user to download. I would like to make this more user friendly by automatically starting the download so the user sees the browsers "Save or Open" window instead of having to click the download link. I'm guessing I need to somehow change the headers in the Ajax success callback function?? I'm not really sure what I should be titling my searches or even if this is possible. Thanks!

    Read the article

  • jQuery monitoring form field created by AJAX query

    - by Jon Rhoades
    Preface: I am sure this is incredibly simple, but I have searched this site & the jQuery site and can't figure out the right search term to get an answer - please excuse my ignorance! I am adding additional form fields using jQuery's ajax function and need to then apply additional ajax functions to those fields but can't seem to get jQuery to monitor these on the fly form fields. How can I get jQuery to use these new fields? $(document).ready(function() { $('#formField').hide(); $('.lnk').click(function() { var t = this.id; $('#formField').show(400); $('#form').load('loader.php?val=' + t); }); //This works fine if the field is already present var name = $('#name'); var email = $('#email'); $('#uid').keyup(function () { var t = this; if (this.value != this.lastValue) { if (this.timer) clearTimeout(this.timer); this.timer = setTimeout(function () { $.ajax({ url: 'loader.php', data: 'action=getUser&uid=' + t.value, type: 'get', success: function (j) { va = j.split("|"); displayname = va[1]; mail = va[2]; name.val(displayname); email.val(mail); } }); }, 200); this.lastValue = this.value; } }); }); So if the is present in the basic html page the function works, but if it arrives by the $.load function it doesn't - presumably because $(document).ready has already started. I did try: $(document).ready(function() { $('#formField').hide(); $('.lnk').click(function() { var t = this.id; $('#formField').show(400); $('#form').load('loader.php?val=' + t); prepUid(); }); }); function prepUid(){ var name = $('#name'); var email = $('#email'); $('#uid').keyup(function () { snip........... But it didn't seem to work...

    Read the article

  • Stop Duplicate Ajax Submisions?

    - by chobo2
    Hi I am wondering what is the best way to stop duplciate submissions when using jquery and ajax? I come up with 2 possible ways but not sure if these are the only 2. On Ajax start disable all buttons till request is done. 2 problems I see with this though is I use jquery model dialog so I don't know how easy it would be to disable those button as I not sure if they have id's. Second I if the the request hangs the user has really no way to try again since all the buttons are disabled. I am looking into something called AjaxQueue at this time I have no clue if it is what I need or how it works since the site where the plugin is apparently down for maintenance. http://docs.jquery.com/AjaxQueue

    Read the article

  • Advice on my jQuery Ajax Function

    - by NessDan
    So on my site, a user can post a comment on 2 things: a user's profile and an app. The code works fine in PHP but we decided to add Ajax to make it more stylish. The comment just fades into the page and works fine. I decided I wanted to make a function so that I wouldn't have to manage 2 (or more) blocks of codes in different files. Right now, the code is as follows for the two pages (not in a separate .js file, they're written inside the head tags for the pages.): // App page $("input#comment_submit").click(function() { var comment = $("#comment_box").val(); $.ajax({ type: "POST", url: "app.php?id=<?php echo $id; ?>", data: {comment: comment}, success: function() { $("input#comment_submit").attr("disabled", "disabled").val("Comment Submitted!"); $("textarea#comment_box").attr("disabled", "disabled") $("#comments").prepend("<div class=\"comment new\"></div>"); $(".new").prepend("<a href=\"profile.php?username=<?php echo $_SESSION['username']; ?>\" class=\"commentname\"><?php echo $_SESSION['username']; ?></a><p class=\"commentdate\"><?php echo date("M. d, Y", time()) ?> - <?php echo date("g:i A", time()); ?></p><p class=\"commentpost\">" + comment + "</p>").hide().fadeIn(1000); } }); return false; }); And next up, // Profile page $("input#comment_submit").click(function() { var comment = $("#comment_box").val(); $.ajax({ type: "POST", url: "profile.php?username=<?php echo $user; ?>", data: {comment: comment}, success: function() { $("input#comment_submit").attr("disabled", "disabled").val("Comment Submitted!"); $("textarea#comment_box").attr("disabled", "disabled") $("#comments").prepend("<div class=\"comment new\"></div>"); $(".new").prepend("<a href=\"profile.php?username=<?php echo $_SESSION['username']; ?>\" class=\"commentname\"><?php echo $_SESSION['username']; ?></a><p class=\"commentdate\"><?php echo date("M. d, Y", time()) ?> - <?php echo date("g:i A", time()); ?></p><p class=\"commentpost\">" + comment + "</p>").hide().fadeIn(1000); } }); return false; }); Now, on each page the box names will always be the same (comment_box and comment_submit) so what do you guys think of this function (Note, the postComment is in the head tag on the page.): // On the page, (profile.php) $(function() { $("input#comment_submit").click(function() { postComment("profile", "<?php echo $user ?>", "<?php echo $_SESSION['username']; ?>", "<?php echo date("M. d, Y", time()) ?>", "<?php echo date("g:i A", time()); ?>"); }); }); Which leads to this function (which is stored in a separate file called functions.js): function postComment(page, argvalue, username, date, time) { if (page == "app") { var arg = "id"; } if (page == "profile") { var arg = "username"; } var comment = $("#comment_box").val(); $.ajax({ type: "POST", url: page + ".php?" + arg + "=" + argvalue, data: {comment: comment}, success: function() { $("textarea#comment_box").attr("disabled", "disabled") $("input#comment_submit").attr("disabled", "disabled").val("Comment Submitted!"); $("#comments").prepend("<div class=\"comment new\"></div>"); $(".new").prepend("<a href=\"" + page + ".php?" + arg + "=" + username + "\" class=\"commentname\">" + username + "</a><p class=\"commentdate\">" + date + " - " + time + "</p><p class=\"commentpost\">" + nl2br(comment) + "</p>").hide().fadeIn(1000); } }); return false; } That's what I came up with! So, some problems: When I hit the button the page refreshes. What fixed this was taking the return false from the function and putting it into the button click. Any way to keep it in the function and have the same effect? But my real question is this: Can any coders out there that are familiar to jQuery tell me techniques, coding practices, or ways to write my code more efficiently/elegantly? I've done a lot of work in PHP but I know that echoing the date may not be the most efficient way to get the date and time. So any tips that can really help me streamline this function and also make me better with writing jQuery are very welcome!

    Read the article

  • ASP.net Ajax tab container not appearing

    - by Eyla
    I created new web project using VS 2008 with enabled Ajax template with C# and Framework 3.5. I added Ajax reference to the project and I can see all Ajax toolkit in my tool box. The problem that when I add tab container with Tab Panels then run the projects nothing appear on the browser and I tried few browsers. I'm including my code and I wish that someone would help me. Regards, My Code: ................................................................ <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Contacts._Default" %> <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %> <!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 runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <div> <asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0"> <asp:TabPanel runat="server" HeaderText="TabPanel1" ID="TabPanel1"> <ContentTemplate> tab 1 </ContentTemplate> </asp:TabPanel> <asp:TabPanel runat="server" HeaderText="TabPanel2" ID="TabPanel2"> <ContentTemplate> tab 2 </ContentTemplate> </asp:TabPanel> <asp:TabPanel runat="server" HeaderText="TabPanel3" ID="TabPanel3"> <ContentTemplate> tab 3 </ContentTemplate> </asp:TabPanel> </asp:TabContainer> </div> </form> </body> </html>

    Read the article

  • jQuery .ajax() call to page method works in FF only when async is false

    - by Steve
    I'm calling a page method using .ajax() and it works in IE8 whatever the value of async is. However, in FF3.6, it only works with async set to false. When async is set to true, in Firebug, I just see status aborted. The page validates. I can work with async set to false, but any clues as to why FF can't work with async set to true? $("[id$='_www']").click(function() { var hhh = false; $.ajax({ async: false, cache: false, type: "POST", url: "/abc/def.aspx/jkl", contentType: "application/json; charset=utf-8", dataType: "json", data: "{ 'eee': '" + window.location.href.match(/\d{1,3}$/) + "', 'ttt': '" + $("[id$='_zzz']").val() + "' }", success: function(msg) { $("#ggg").html(msg.d); }, error: function(xhr, err) { hhh = true; } }); return hhh; });

    Read the article

  • jQuery .Ajax() function selector , store specific data in variable

    - by user279321
    I am new to jQuery and I have the following problem. My project has say 2 pages, 1.JSP and 2.html. Now I want to pick selected data from 2.html and use it on 1.JSP. Now this was achieved very easily using .load but I want the data to be present in a JavaScript variable rather than put it on the page (div tags, etc.), so that I can work upon that data (modify or add to database). I tried using .ajax and was able to write the following code: var value = (function () { var val = nulll; var filename = " 2.html"; $.ajax ({ 'async': false, 'global': false, 'url': filename, 'success' : function(data) { val = data; } }) return val; })() document.write(value) Where do I put the selector format (say div.id5) so that my variable have only relevant data rather than the full file data?

    Read the article

  • get the response of a jquery ajax call as an input parameter of another function:

    - by Nauman Bashir
    Hello, Is it possible to make a jquery ajax call, and get the response as an input parameter of another function: here is an example, i have the following function call at a location: updateTips(validationTextObject,objUsers.fetchAvailable()); the objUsers.fetchAvailable() function makes a ajax call to the server. The callback function on successful call would be something like this. It is being used to process the result BHUsers.prototype.recvAvailable= function(response){ // some kind of processing over here return (response["status"] == "OK")? "Available" : "Not Available"; } I want that fuction to return the processed result which can be used as a parameter to the function updateTips The primary goal of this is to be able to do all of this for multiple scenarios, rather than writing multiple functions for the same call. Also i want the calling and the response processing functions to just do what they are doing. I dont want to add html objects into it. Any Clues?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >