Search Results

Search found 21127 results on 846 pages for 'jquery ajax'.

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

  • Using jQuery to auto-populate a form field from another form field

    - by Jon
    Has anyone used jquery to take data from one form field and put it into another? I'm trying to create a form that when one text input is filled out a second is auto-populated with the first letter of the word that is in the first text input. I'm thinking I can limit the second text input to one character to help get the desired result, but I'm not having luck getting jquery to get the second text input and auto-populate once the first is entered. Here is the code I'm using: <script type="text/javascript"> jQuery(document).ready(function($) { $('#textBox1').keyup(function(){ if($.trim($('#textBox2').val()) == '') $('#textBox2').val($(this).val().substring(0, 1); }); }); </script> Also, do I need to have any in the text input fields of the form other than matching "textBox1" id/names? Any suggestions?

    Read the article

  • jQuery and Windows Azure

    - by Latest Microsoft Blogs
    The goal of this blog entry is to describe how you can host a simple Ajax application created with jQuery in the Windows Azure cloud. In this blog entry, I make no assumptions. I assume that you have never used Windows Azure and I am going to walk through Read More......(read more)

    Read the article

  • jQuery ajax returns

    - by Tom
    I think this will be some obvious problem, but I cannot figure it out. I hope someone can help me. So I have a slider with 3 slides - Intro, Question, Submit Now I want to make sure that if the question is answered wrong people cannot slide to Submit. The function to move slide is like this: function changeSlide(slide){ // In case current slide is question check the answer if (jQuery('.modalSteps li.current',base).hasClass('questionStep')){ checkAnswer(jQuery('input[name="question_id"]',base).val(), jQuery('input[name="answer"]:checked',base).val()); } jQuery('.modalSteps li.current',base).fadeOut('fast',function(){ jQuery(this).removeClass('current'); jQuery(slide).fadeIn('fast',function(){ jQuery(slide).addClass('current'); }); }); // In case the new slide is question, load the question if (jQuery(slide).hasClass('questionStep')){ var country = jQuery('input[name="country"]:checked',base).val(); loadQuestion(country); } } Now as you can see on first lines, I am calling function checkAnswer, which takes id of question and id of answer and pass it to the AJAX call. function checkAnswer(question, answer){ jQuery.ajax({ url: window.base_url+'ajax/check_answer/'+question+'/'+answer+'/', success: function(data){ if (!data.success){ jQuery('.question',base).html(data.message); } } }); } The problem i am having is that I cannot say if(checkAnswer(...)){} Because of Ajax it always returns false or undefined. What I need is something like this: function changeSlide(slide){ // In case current slide is question check the answer if (jQuery('.modalSteps li.current',base).hasClass('questionStep')){ if (!checkAnswer(jQuery('input[name="question_id"]',base).val(), jQuery('input[name="answer"]:checked',base).val())){ return false; } } ... So it will prevent the slide from moving on. Now when Im thinking about it, I will probably have slide like "Wrong answer" so I could just move the slide there, but I would like to see the first solution anyway. Thank you for tips

    Read the article

  • jQuery modal dialog on ajaxStart event

    - by bdl
    I'm trying to use a jQuery UI modal dialog as a loading indicator via the ajaxStart, ajaxStop / ajaxComplete events. When the page fires, an Ajax handler loads some data, and the modal dialog shows just fine. However, it never hides or closes the dialog when the Ajax event is complete. It's a very small bit of code from the local server that is returned, so the actual Ajax event is very quick. Here's my actual code for the modal div: $("#modalwindow").dialog({ modal: true, height: 50, width: 200, zIndex: 999, resizable: false, title: "Please wait..." }) .bind("ajaxStart", function(){ $(this).show(); }) .bind("ajaxStop", function(){ $(this).hide(); }); The Ajax event is just a plain vanilla $.ajax({}) GET method call. Based on some searching here and Google, I've tried altering the ajaxStop handler to use $("#modalwindow").close(), $("#modalwindow").destroy(), etc. (#modalwindow referred to here as to give explicit context). I've also tried using the standard $("#modalwindow").dialog({}).ajaxStart(... as well. Should I be binding the events to a different object? Or calling them from within the $.ajax() complete event? I should mention, I'm testing on the latest IE8, FF 3.6 and Chrome. All have the same / effect.

    Read the article

  • Can somebody explain the differences, status and future of the various ASP.NET AJAX libraries and to

    - by tjrobinson
    I'm confused about the differences and relationships between the various Microsoft ASP.NET AJAX components/libraries/toolkits and particularly the naming of them. It starts off relatively simple with ASP.NET AJAX itself: ASP.NET AJAX 1.0 (available for ASP.NET 2.0 in a separate package called ASP.NET 1.0 Extensions) ASP.NET AJAX 3.5 (included with ASP.NET 3.5) ASP.NET AJAX 4.0 (included with ASP.NET 4.0) Then come the various projects on CodePlex and elsewhere: ASP.NET AJAX Control Toolkit (aka Original Ajax Control Toolkit) Samples CodePlex It seems that the September 2009 Release is the final release of the Original Ajax Control Toolkit and that it's been superseded by... Ajax Control Toolkit in ASP.NET Ajax Library It looks like the old ASP.NET AJAX Control Toolkit has now become part of a larger ASP.NET Ajax Library but is still maintained seperately on CodePlex. This release is in beta at time of writing so presumably if I want to use the "Control Toolkit" I should stick with the September 2009 Release of the Original ASP.NET AJAX Control Toolkit CodePlex Microsoft Ajax Library Preview Is this the same as the ASP.NET Ajax Library mentioned above just with a confusing name variation? Is the "Control Toolkit" included in Preview 6 and is it older newer or older than the code in Ajax Control Toolkit in ASP.NET Ajax Library? CodePlex Microsoft ASP.NET Ajax Wiki - note the inconsistent insertion of ASP.NET into the name Links to useful articles, roadmaps would be useful.

    Read the article

  • jQuery UI dialog and Ajax POST, JSON

    - by Mithun
    Is it possible to combine Ajax post with jQuery UI dialog? And I want to process the ajax reponse in JSON to HTML for showing inside the Dialog box var url = AJAX_URL+requestId+'/'+userId; // Need to POST the requestId and userId instead of GET $("body").append("<div id='dialog-modal'>Loading...</div>"); $("#dialog-modal").dialog("destroy"); $("#dialog-modal").load(url).dialog( { modal: true, title: "Update Status", buttons: { Cancel : function() { $(this).dialog('close'); }, Update: function() { // Do something } } } );

    Read the article

  • JQuery Ajax Load Mobile Browser Back Functionality

    - by Brad
    Currently working on a mobile site using the .load() technique: $.ajaxSetup ({cache: false}); contentLoad(); function contentLoad() { $('a.inline').click(function(){ var toLoad = $(this).attr('href')+' #content'; $('#loading').show(); $('#content').load(toLoad,'',showNewContent) function showNewContent() { $('#loading').hide(); $('#content').show(); contentLoad(); } return false; }); } How would I be able to integrate back and forward button functionality into mobile browsers? Hope this is possible. Thanks in advance.

    Read the article

  • how do you hook up a callback event when using jquery ui tabs in ajax mode

    - by ooo
    Here is my html code using jquery ui tabs. As you can see, for the third tab, i am loading remotely through a feature built into jquery ui tabs where you just put a link in and it retrieves it remotely. My one open issue is that i would like a callback method when its done retrieving /Tracker/DailyTracker. is this possible? <div id="tabs"> <ul> <li><a href="#tab1">1</a></li> <li><a href="#tab2">2</a></li> <li><a href="/Tracker/DailyTracker"><span>3</span></a></li>

    Read the article

  • Rails 3.2 Ajax Update Div when Text Field Populated

    - by ctilley79
    In the end I would like a text field that passes a client_id to the partial. I would like to do this asynchronously so the shipment_products partial would dynamically change when the textfield value was updated. What is the best way to do this? In index.html.erb <!-- Text Field Here--> <div id="available_products"> <%= render "shipment_products" %> </div> In _shipment_products.html.erb <div id="shipment_products_container"> <h3>Assign Products to Ship<\h3> <ul class="shipment_products" id="shipment_products"> <% Product.by_client(client_id).each do |product|%> <!-- TextField value passed here --> <%= content_tag_for :li, product, :value => product.id do %> <%= hidden_field_tag("shipment[product_ids][]", product.id) %> <%= product.product_name %> <% end %> <% end %> <\ul> </div> This is similar to what I want in the end.

    Read the article

  • GLOBAL loading inside each single button with Jquery in ajax calls of asp.net mvc

    - by Ricky
    I have the following scenario: I have a button\link with a image inside like this: <button type="submit" id="myButton" class="button"><img src="../../Content/images/check.png" id="defaultImage" /> SaveData!!!</button> We are OK here! Now what I need to do is: I want on the click that the image change for a loading element that is previously loaded in the page like this: <img id="loadingImage" src="../../Content/images/loader.gif" style="display: none;" alt="loading"/> And then when the load complete turn back the old button image, I ended with this code: function loader() { var $button = $('#myButton'); if (btnState == '1') { $button.find('img').hide(); $button.prepend($('#loadingImage')); $('#loadingImage').css({ 'display': 'inherit' }); btnState = '0'; } else { $button.find('img').hide(); $button.prepend($('#defaultImage')); $('#defaultImage').show(); btnState = '1'; } } This does the trick for ONE SINGLE button(since I pass its ID in the function) but, when I have for example a grid with a button on each line, I found inviable when managing a screen with many buttons do this for each of then. The main question is: How can I make this method general for all buttons/links on one specific class in the page? The goal is: Click a button, get the image and change it and stop(can be manual). I just don't wanna have to Hook ALL buttons.

    Read the article

  • problems with passing html to the server with jquery

    - by CoffeeCode
    i have an ajax call $.ajax({ url: '<%=Url.Action("SaveDetails","Survey") %>', dataType: 'JSON', cache: false, data: { Id: selectedRow.Id, Value: surveyValue, FileName: filename, FileGuid: fileguid }, success: function(data) { ... } }); where the surveyValue is a html string. this call doesn't work. but is i change the surveyValue to an ordinary text i works fine. how can i pass the html to the server?

    Read the article

  • jquery block UI malfunction on ajax loading event

    - by Ygam
    problem: trigger errored when block UI is called on this code (function($){ function preloader() { $('a#preloader').click(function(e){ e.preventDefault(); var url = base_url + 'runtest/preloader'; $('div#content').load(url, preloaderCallback); }); } function remotePreload() { $('a#remotepreload').click(function(e){ e.preventDefault(); var object = $(this); object.data('clicked', 'yes'); var url = base_url + 'runtest/remote_preloader'; $('div#content').load(url); }); } /* * callback functions */ function preloaderCallback() { $('div.imageholder img').hide(); $('div.imageholder img').each(function(){ var img = new Image(); var sursa = $(this).attr('src'); var parent = $(this).parent(); var preloaderSource = '<img src="' + base_url + 'media/images/preloader.gif' + '" alt="loader"/>'; parent.append(preloaderSource); $(img).load(function(){ parent.append($(this)); $(this).hide().fadeIn(500); $(this).siblings().remove(); }).attr('src', sursa); }); } function blocker() { $('#content').block(); } function handlePageLoad() { $('a#remotepreload').ajaxStart(function(e){ var elem = $(e.target); if (elem.data('clicked') == 'yes') { // error when blocker() function is called here alert('Started'); } }); $('a#remotepreload').ajaxComplete(function(e){ var elem = $(e.target); if (elem.data('clicked') == 'yes') { elem.removeData('clicked'); alert('Ended'); } }); } // call onready functions $(function(){ preloader(); remotePreload();handlePageLoad(); }); })(jQuery); // here's the error from firefox's debugger uncaught exception: [Exception... "Could not convert JavaScript argument arg 0" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://localhost/testsuite/media/js/jquery.min.js :: anonymous :: line 115" data: no] here's the html markup <div id="wrap"> <div id="header"> <?= $header ?> </div> <div id="content"> <?= $content ?> </div> <div id="sidebar"> <?= $sidebar ?> </div> <div id="footer"> <?= $footer ?> </div> </div> EDIT I was using Jquery 1.4.1 when this happened. Switched back to 1.3 and everything went back to normal.

    Read the article

  • jquery - loose click() event after ajax call ???

    - by niczoom
    At the following webpage liamharding.com/pgi.php I have an option panel on the left side of the page which opens and close's upon clicking the panels 'arrow', this works fine until you select a market (for testing use one of the 'Random Walk' markets and click 'Show/Refesh Graphs'), this then makes an ajax call using get_graph(forexName, myCount, divIsNew) function. Once this call is completed a graph(s) is displayed and then my options panels click() event does not work? The ajax call returns the data in a variable ajax_data, the problem happens when I perform the following code var jq_ajax_data = $("<div/>").html(ajax_data); . I need to wrap it in a so I can extract data from it using jQuery. If this line of code is commented out the click() event works fine ?? Hope somebody can help, I have spent a lot of time but cant find what the problem is.

    Read the article

  • jQuery: Can't get tooltip plugin to work

    - by Rosarch
    I'm trying to use this tooltip plugin: http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/. I can't seem to get it to work. <head> <script type="text/javascript" src="/static/JQuery.js"></script> <script type="text/javascript" src="/static/jquery-ui-1.8.1.custom.min.js"></script> <script type="text/javascript" src="/static/jquery.json-2.2.min.js"></script> <script type="text/javascript" src="/static/jquery.form.js"></script> <script type="text/javascript" src="/static/js-lib/jquery.bgiframe.js"></script> <script type="text/javascript" src="/static/js-lib/jquery.delegate.js"></script> <script type="text/javascript" src="/static/js-lib/jquery.dimensions.js"></script> <script type="text/javascript" src="/static/jquery.tooltip.js"></script> <script type="text/javascript" src="/static/sprintf.js"></script> <script type="text/javascript" src="/static/clientside.js"></script> </head> I try it out in a simple example: clientside.js: $(document).ready(function () { $("#set1 *").tooltip(); }); The target html: <div id="set1"> <p id="welcome">Welcome. What is your email?</p> <form id="form-username-form" action="api/user_of_email" method="get"> <p> <label for="form-username">Email:</label> <input type="text" name="email" id="form-username" /> <input type="submit" value="Submit" id="form-submit" /> </p> </form> <p id="msg-user-accepted"></p> </div> Unfortunately, nothing happens. What am I doing wrong?

    Read the article

  • jquery - lose click() event after ajax call???

    - by niczoom
    At the following webpage liamharding.com/pgi.php I have an option panel on the left side of the page which opens and closes upon clicking the panels 'arrow', this works fine until you select a market (for testing use one of the 'Random Walk' markets and click 'Show/Refesh Graphs'), this then makes an ajax call using get_graph(forexName, myCount, divIsNew) function. Once this call is completed a graph(s) is displayed and then my options panels click() event does not work? The ajax call returns the data in a variable ajax_data, the problem happens when I perform the following code var jq_ajax_data = $("<div/>").html(ajax_data); . I need to wrap it in a so I can extract data from it using jQuery. If this line of code is commented out the click() event works fine ?? Hope somebody can help, I have spent a lot of time but cant find what the problem is.

    Read the article

  • Form submitted via dialog opens dialog again

    - by VikingGoat
    I have a form in a jquerymobile dialog box that I am submitting via jQuery Ajax. Currently my problem is that once the form is submitted the same dialog box is opened again on top of the original dialogbox. So that my url reads before submission: url/index.php#&ui-state=dialog and then after submission: url/index.php#&ui-state=dialog#&ui-state=dialog&ui-state=dialog Has anyone ever encountered something like this before? [edit added code example] $(function(){ $("#form").submit(function(e){ e.preventDefault(); var dataString = $("#form").serialize(); errorInput = $("input[name=valOne]#valOne").val(); $.ajax({ type: "GET", url: "formHandler.php", data: dataString, dataType: "text", success: function(data){ if(data.toLowerCase().indexOf("error") >= 0){ alert(data); $(".ui-dialog").dialog("close"); $("#valOne").val(errorInput); //the reentering info so user doesn't have to }else{ $(".ui-dialog").dialog("close"); location.href="index.php"; } }, error:function (xhr, ajaxOptions, thrownError){ alert(thrownError); } }); }); });

    Read the article

  • Daily tech links for .net and related technologies - Mar 29-31, 2010

    - by SanjeevAgarwal
    Daily tech links for .net and related technologies - Mar 29-31, 2010 Web Development Querying the Future With Reactive Extensions - Phil Haack Creating an OData API for StackOverflow including XML and JSON in 30 minutes - Scott Hanselman MVC Automatic Menu - Nuri Halperin jqGrid for ASP.NET MVC - TriRand Team Foolproof Provides Contingent Data Annotation Validation for ASP.NET MVC 2 -Nick Riggs Using FubuMVC.UI in asp.net MVC : Getting started - Cannibal Coder Building A Custom ActionResult in MVC...(read more)

    Read the article

  • Daily tech links for .net and related technologies - Apr 15-18, 2010

    - by SanjeevAgarwal
    Daily tech links for .net and related technologies - Apr 15-18, 2010 Web Development Guarding against CSRF Attacks in ASP.NET MVC2 - Scott Kirkland Same Markup: Writing Cross-Browser Code - Tony Ross Introducing Machine.Specifications.Mvc - James Broome ASP.NET 4 - Breaking Changes and Stuff to be Aware of - Scott Hanselman JSON Hijacking in ASP.NET MVC 2 - Matt Easy And Safe Model Binding In ASP.NET MVC - Justin Etheredge MVC Portable Areas Enhancement - Embedded Resource Controller - Steve Michelotti...(read more)

    Read the article

  • Using jQuery Live instead of jQuery Hover function

    - by hajan
    Let’s say we have a case where we need to create mouseover / mouseout functionality for a list which will be dynamically filled with data on client-side. We can use jQuery hover function, which handles the mouseover and mouseout events with two functions. See the following example: <!DOCTYPE html> <html lang="en"> <head id="Head1" runat="server">     <title>jQuery Mouseover / Mouseout Demo</title>     <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.4.4.js"></script>     <style type="text/css">         .hover { color:Red; cursor:pointer;}     </style>     <script type="text/javascript">         $(function () {             $("li").hover(               function () {                   $(this).addClass("hover");               },               function () {                   $(this).removeClass("hover");               });         });     </script> </head> <body>     <form id="form2" runat="server">     <ul>         <li>Data 1</li>         <li>Data 2</li>         <li>Data 3</li>         <li>Data 4</li>         <li>Data 5</li>         <li>Data 6</li>     </ul>     </form> </body> </html> Now, if you have situation where you want to add new data dynamically... Lets say you have a button to add new item in the list. Add the following code right bellow the </ul> tag <input type="text" id="txtItem" /> <input type="button" id="addNewItem" value="Add New Item" /> And add the following button click functionality: //button add new item functionality $("#addNewItem").click(function (event) {     event.preventDefault();     $("<li>" + $("#txtItem").val() + "</li>").appendTo("ul"); }); The mouse over effect won't work for the newly added items. Therefore, we need to use live or delegate function. These both do the same job. The main difference is that for some cases delegate is considered a bit faster, and can be used in chaining. In our case, we can use both. I will use live function. $("li").live("mouseover mouseout",   function (event) {       if (event.type == "mouseover") $(this).addClass("hover");       else $(this).removeClass("hover");   }); The complete code is: <!DOCTYPE html> <html lang="en"> <head id="Head1" runat="server">     <title>jQuery Mouseover / Mouseout Demo</title>     <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.4.4.js"></script>     <style type="text/css">         .hover { color:Red; cursor:pointer;}     </style>     <script type="text/javascript">         $(function () {             $("li").live("mouseover mouseout",               function (event) {                   if (event.type == "mouseover") $(this).addClass("hover");                   else $(this).removeClass("hover");               });             //button add new item functionality             $("#addNewItem").click(function (event) {                 event.preventDefault();                 $("<li>" + $("#txtItem").val() + "</li>").appendTo("ul");             });         });     </script> </head> <body>     <form id="form2" runat="server">     <ul>         <li>Data 1</li>         <li>Data 2</li>         <li>Data 3</li>         <li>Data 4</li>         <li>Data 5</li>         <li>Data 6</li>     </ul>          <input type="text" id="txtItem" />     <input type="button" id="addNewItem" value="Add New Item" />     </form> </body> </html> So, basically when replacing hover with live, you see we use the mouseover and mouseout names for both events. Check the working demo which is available HERE. Hope this was useful blog for you. Hope it’s helpful. HajanReference blog: http://codeasp.net/blogs/hajan/microsoft-net/1260/using-jquery-live-instead-of-jquery-hover-function

    Read the article

  • useFastClick in JQuery Mobile

    - by Yousef_Jadallah
      Normal 0 false false false EN-US X-NONE AR-SA /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:Arial; mso-bidi-theme-font:minor-bidi;} For who want to convert the application from JQM Alpha to JQM Beta 1, needs to bind  click  events to the new vclick one. Click event is working in general browsers butt that is needed for iOS and Android, useFastClick  is (touch + mouse click). Moreover if you have this event alot in your project you can turn useFastClick off in mobileinit event: $(document).bind("mobileinit", function () {             $.mobile.useFastClick = false; });   vclick event is needed to support touch events to make the page changes to happen faster, and to perform the URL hiding. So you need to change something like this  $('btnShow').live("click", function (evt) {   To :  $('btnShow').live("vclick", function (evt) {     For more information : http://jquerymobile.com/test/docs/api/globalconfig.html   Here you can find full example in this case : <!DOCTYPE ><html xmlns="http://www.w3.org/1999/xhtml"><head>    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css" />    <script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>    <script src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"></script>    <script type="text/javascript">     //Here you need to use vclick instead of click event         $('ul[id="MylistView"] a').live("vclick", function (evt) {            alert('list click');        });      </script>    <title></title></head><body>    <div id="FirstPage" data-role="page" data-theme="b">        <div data-role="header">            <h1>                Page Title</h1>        </div>        <div data-role="content">            <ul id="MylistView" data-role="listview" data-theme="g">                <li><a href="#SecondPage">Acura</a></li>                <li><a href="#SecondPage">Audi</a></li>                <li><a href="#SecondPage">BMW</a></li>            </ul>        </div>        <div data-role="footer">            <h4>                Page Footer</h4>        </div>    </div>    <div id="SecondPage" data-role="page" data-theme="b"   >        <div data-role="header" >            <h1>                Page Title</h1>        </div>        Second Page        <div data-role="footer">            <h4>                Page Footer</h4>        </div>    </div></body></html>     Hope that helps.

    Read the article

  • jQuery code in ajax loaded content only runs once

    - by Michael Howland
    I have been looking around SO for a while and haven't been able to find anything that matches my issue, which I'm not even sure I can explain that well, so take that for what it's worth. I have a page that loads content into a div via AJAX (using the .load() method). There are several links in the navigation, meaning the content will change while navigating the site without refreshing the entire page. (Actually, to be honest, I just cribbed the DocTemplate layout [http://css-tricks.com/examples/DocTemplate/] from css-tricks.com. Apparently while I'm not a re-invent the wheel type programmer, I am a bash my head against the wheel incessantly to get it to work programmer.) So, index.php loads up some DB content in a div. There is also a jQuery UI modal input form on index.php. Essentially, the only HTML on the page is an empty div and a form. This all works fine, until I call up another page, then go back to index.php. The DB content is not loaded, and my form is shown there in all its naked glory. I know why this is happening. The page was not refreshed, nothing kicked off the code to load the content and hide the form. My question is, how can I ensure that the AJAX .load() and the .dialog() will run when loading index.php again? Is it even possible? Thanks, and my apologies for the length. I get verbose when I'm confused.

    Read the article

  • Ajax call in a jQuery plugin not working properly

    - by Saneef
    I'm trying to create a jQuery plugin, inside I need to do an AJAX call to load an xml. jQuery.fn.imagetags = function(options) { s = jQuery.extend({ height:null, width:null, url:false, callback:null, title:null, }, options); return this.each(function(){ obj = $(this); //Initialising the placeholder $holder = $('<div />') .width(s.width).height(s.height) .addClass('jimageholder') .css({ position: 'relative', }); obj.wrap($holder); $.ajax({ type: "GET", url: s.url, dataType: "xml", success:function(data){ initGrids(obj,data,s.callback,s.title); } , error: function(data) { alert("Error loading Grid data."); }, }); function initGrids(obj, data,callback,gridtitle){ if (!data) { alert("Error loading Grid data"); } $("gridlist gridset",data).each(function(){ var gridsetname = $(this).children("setname").text(); var gridsetcolor = ""; if ($(this).children("color").text() != "") { gridsetcolor = $(this).children("color").text(); } $(this).children("grid").each(function(){ var gridcolor = gridsetcolor; //This colour will override colour set for the grid set if ($(this).children("color").text() != "") { gridcolor = $(this).children("color").text(); } //addGrid(gridsetname,id,x,y,height,width) addGrid( obj, gridsetname, $(this).children("id").text(), $(this).children("x").text(), $(this).children("y").text(), $(this).children("height").text(), $(this).children("width").text(), gridcolor, gridtitle ); }); }); } function addGrid(obj,gridsetname,id,x,y,height,width,color,gridtitle){ //To compensate for the 2px border height-=4; width-=4; $grid = $('<div />') .addClass(gridsetname) .attr("id",id) .addClass('gridtag') .imagetagsResetHighlight() .css({ "bottom":y+"px", "left":x+"px", "height":height+"px", "width":width+"px", }); if(gridtitle != null){ $grid.attr("title",gridtitle); } if(color != ""){ $grid.css({ "border-color":color, }); } obj.after($grid); } }); } The above plugin I bind with 2 DOM objects and loads two seperate XML files but the callback function is run only on the last DOM object using both loaded XML files. How can I fix this, so that the callback is applied on the corresponding DOMs. Is the above ajax call is correct? Sample usage: <script type="text/javascript"> $(function(){ $(".romeo img").imagetags({ height:500, width:497, url: "sample-data.xml", title: "Testing...", callback:function(id){ console.log(id); }, }); }); </script> <div class="padding-10 min-item background-color-black"> <div class="romeo"><img src="images/samplecontent/test_500x497.gif" alt="Image"> </div> </div> <script type="text/javascript"> $(function(){ $(".romeo2 img").imagetags({ height:500, width:497, url: "sample-data2.xml", title: "Testing...", callback:function(id){ console.log(id); }, }); }); </script> <div class="padding-10 min-item background-color-black"> <div class="romeo2"><img src="images/samplecontent/test2_500x497.gif" alt="Image"> </div> </div> Here is the sample XML data: <?xml version="1.0" encoding="utf-8"?> <gridlist> <gridset> <setname>gridset4</setname> <color>#00FF00</color> <grid> <color>#FF77FF</color> <id>grid2-324</id> <x>300</x> <y>300</y> <height>60</height> <width>60</width> </grid> </gridset> <gridset> <setname>gridset3</setname> <color>#00FF00</color> <grid> <color>#FF77FF</color> <id>grid2-212</id> <x>300</x> <y>300</y> <height>100</height> <width>100</width> </grid> <grid> <color>#FF77FF</color> <id>grid2-1212</id> <x>200</x> <y>10</y> <height>200</height> <width>10</width> </grid> </gridset> </gridlist>

    Read the article

  • JQuery Ajax control

    - by Anycolor
    Everybody hi. There is a problem with my own AJAX library, that I can't solve. I have some block (#ajax-loading), that has events: $('#ajax-loading') .bind('ajaxStart', function() { $('#ajax-loading').show(); }) .bind('ajaxStop', function() { $('#ajax-loading').fadeOut(150); }); For running AJAX I have special method: run: function(data, callback) { if(this.request) { this.request.abort(); } this.request = $.getJSON(window.location.pathname, data , callback); }, So .request holds current AJAX request. What do I want? My #ajax-loading block contains the button, than should Cancel current AJAX request. As I supposed, the function, making Cancel shoud contain: abort: function() { if(ajax.request) { this.request.abort(); $('#ajax-loading').fadeOut(150); } } But, as I said, there is a problem: my AJAX request cancels, loading-block hides, but when another request starts, this block doesn't shows again. It seems that when I abort AJAX request, the ajaxStop event doesn't happen. And when I run new request ajaxStart doesn't happen. I think it can be connected with readyState or status field of XMLHttpRequest, or smth similar. Could anyone help me with this or explain what's wrong. PS: excuse my english, it's not my native language...

    Read the article

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