Search Results

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

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

  • 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

  • PHP and ajax no update taking place

    - by sea_1987
    Hi There, I have an an ajax request that looks like this, $('input.fakecheck').click(function(){ alert("deleteing...."); $.ajax({ url:"/search", type:"POST", data: $(this).attr('name')+"="+$(this).attr('value')+"&remove=Remove", success:function() { alert(data); } }) }) This calls a php function which looks like this, private function _remove_from_short_list($cv_array) { if (is_array($cv_array)) { $short_list = $this->session->userdata('short_list'); $new_list = array_diff_key($short_list, $cv_array); $this->session->set_userdata('short_list', $new_list); } } Essentiallty what happens is that on my page I have a list which is essentially a list of id's taken out of the session, the user can then by click and input(this will change) delete the id from their session. However once the deletion has taken place I want to be able to refresh the list to show that it has taken place, currently nothing happens, until I manually refresh.

    Read the article

  • Implementing fallback from Google AJAX Libraries API to local jQuery

    - by Maxim Z.
    After looking up the advantages and disadvantages of using Google's AJAX Libraries API instead of using jQuery locally, I saw that someone wrote in an answer (here on Stack Overflow, of course) that it's possible to get around the downtime that Google's API sometimes experiences by somehow falling back to a local copy of the library you use. I want to use Google's AJAX Libraries API on my site, but I'm concerned about this possible downtime and I'm curious how such a fallback procedure can be implemented. Has anybody ever tried doing this? Can you point me towards some code that accomplishes such a feat? Thanks in advance.

    Read the article

  • How do I keep child elements together with parent jQuery sortable.

    - by unknowndomain
    I have a list of items like this... <ol> <li> <span></span> <img src="image.png" /> <p>Image Caption</p> </li> </ol> And I want to be able to sort the LI's but not the sub elements, they should just move with their parent. I am using the jQuery to do that... $('ol li').sortable({ 'cursor': 'move' }); And its working but not moving the whole lot just the element you clicked i.e. the <p>, <img> or <span> I can't figure out how to solve this so I looked about and found an option called 'items': '> li' which was recommended but upon using this nothing drags any more but using firebug + jquery plugin I can see there is a sortable on the <li> still. Not sure what to do, example here: http://clareshilland.unknowndomain.co.uk/ Press ctrl+l to login. Enter the login details: Username: clarePassword: demo Select 'edit' from under then 'image' portion of the menu. The sortables should be those polaroids. Thanks in advance, another one I've been banging my head on the table with.

    Read the article

  • Building Web Applications with ACT and jQuery

    - by dwahlin
    My second talk at TechEd is focused on integrating ASP.NET AJAX and jQuery features into websites (if you’re interested in Silverlight you can download code/slides for that talk here). The content starts out by discussing ScriptManager features available in ASP.NET 3.5 and ASP.NET 4 and provides details on why you should consider using a Content Delivery Network (CDN).  If you’re running an external facing site then checking out the CDN features offered by Microsoft or Google is definitely recommended. The talk also goes into the process of contributing to the Ajax Control Toolkit as well as the new Ajax Minifier tool that’s available to crunch JavaScript and CSS files. The extra fun starts in the next part of the talk which details some of the work Microsoft is doing with the jQuery team to donate template, globalization and data linking code to the project. I go into jQuery templates, data linking and a new globalization option that are all being worked on. I want to thank Stephen Walther, Dave Reed and James Senior for their thoughts and contributions since some of the topics covered are pretty bleeding edge right now.The slides and sample code for the talk can be downloaded below.     Download Slides and Samples

    Read the article

  • Inserting HTML code with jquery

    - by J. Robertson
    One of our web applications is a page that takes in a serial number and various information is returned and displayed to the user. The serial is passed via AJAX, and based on the response, one of the following can happen - An error message is shown A new form replaces the previous form Now, the way I am handling this is to use jQuery to destroy (using $.remove()) the table that displayed the initial serial form, then I'm appending another html table that contains another form. Right now I am including that additional form as part of the html source, and just setting it to display:none, then using jQuery to show it when appropriate. However, I don't like this approach because if someone views source on the page, they can see that table html code that is not being displayed. My next thought would be to use AJAX to read in another HTML file, and append it that way. However, I am trying to keep down the number of files this project uses, and since most pages in our project will use AJAX, I could see a case where there are multiple files containing HTML snippets - and that feels sloppy to me. What is the best way to handle a case where multiple html elements are being shown and removed with jQuery?

    Read the article

  • jQuery Templates with ASP.NET MVC

    - by hajan
    In my three previous blogs, I’ve shown how to use Templates in your ASPX website. Introduction to jQuery TemplatesjQuery Templates - tmpl(), template() and tmplItem()jQuery Templates - {Supported Tags}Now, I will show one real-world example which you may use it in your daily work of developing applications with ASP.NET MVC and jQuery. In the following example I will use Pubs database so that I will retrieve values from the authors table. To access the data, I’m using Entity Framework. Let’s pass throughout each step of the scenario: 1. Create new ASP.NET MVC Web application 2. Add new View inside Home folder but do not select a master page, and add Controller for your View 3. BODY code in the HTML <body>     <div>         <h1>Pubs Authors</h1>         <div id="authorsList"></div>     </div> </body> As you can see  in the body we have only one H1 tag and a div with id authorsList where we will append the data from database.   4. Now, I’ve created Pubs model which is connected to the Pub database and I’ve selected only the authors table in my EDMX model. You can use your own database. 5. Next, lets create one method of JsonResult type which will get the data from database and serialize it into JSON string. public JsonResult GetAuthors() {     pubsEntities pubs = new pubsEntities();     var authors = pubs.authors.ToList();     return Json(authors, JsonRequestBehavior.AllowGet); } So, I’m creating object instance of pubsEntities and get all authors in authors list. Then returning the authors list by serializing it to JSON using Json method. The JsonRequestBehaviour.AllowGet parameter is used to make the GET requests from the client become allowed. By default in ASP.NET MVC 2 the GET is not allowed because of security issue with JSON hijacking.   6. Next, lets create jQuery AJAX function which will call the GetAuthors method. We will use $.getJSON jQuery method. <script language="javascript" type="text/javascript">     $(function () {         $.getJSON("GetAuthors", "", function (data) {             $("#authorsTemplate").tmpl(data).appendTo("#authorsList");         });     }); </script>   Once the web page is downloaded, the method will be called. The first parameter of $.getJSON() is url string in our case the method name. The second parameter (which in the example is empty string) is the key value pairs that will be send to the server, and the third function is the callback function or the result which is going to be returned from the server. Inside the callback function we have code that renders data with template which has id #authorsTemplate and appends it to element which has #authorsList ID.   7. The jQuery Template <script id="authorsTemplate" type="text/html">     <div id="author">         ${au_lname} ${au_fname}         <div id="address">${address}, ${city}</div>         <div id="contractType">                     {{if contract}}             <font color="green">Has contract with the publishing house</font>         {{else}}             <font color="red">Without contract</font>         {{/if}}         <br />         <em> ${printMessage(state)} </em>         <br />                     </div>     </div> </script> As you can see, I have tags containing fields (au_lname, au_fname… etc.) that corresponds to the table in the EDMX model which is the same as in the database. One more thing to note here is that I have printMessage(state) function which is called inside ${ expression/function/field } tag. The printMessage function <script language="javascript" type="text/javascript">     function printMessage(s) {         if (s=="CA") return "The author is from California";         else return "The author is not from California";     } </script> So, if state is “CA” print “The author is from California” else “The author is not from California”   HERE IS THE COMPLETE ASPX CODE <!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>Database Example :: jQuery Templates</title>     <style type="text/css">         body           {             font-family:Verdana,Arial,Courier New, Sans-Serif;             color:Black;             padding:2px, 2px, 2px, 2px;             background-color:#FF9640;         }         #author         {             display:block;             float:left;             text-decoration:none;             border:1px solid black;             background-color:White;             padding:20px 20px 20px 20px;             margin-top:2px;             margin-right:2px;             font-family:Verdana;             font-size:12px;             width:200px;             height:70px;}         #address           {             font-style:italic;             color:Blue;             font-size:12px;             font-family:Verdana;         }         .author_hover {background-color:Yellow;}     </style>     <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.min.js" type="text/javascript"></script>     <script src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.js" type="text/javascript"></script>     <script language="javascript" type="text/javascript">         function printMessage(s) {             if (s=="CA") return "The author is from California";             else return "The author is not from California";         }     </script>     <script id="authorsTemplate" type="text/html">         <div id="author">             ${au_lname} ${au_fname}             <div id="address">${address}, ${city}</div>             <div id="contractType">                         {{if contract}}                 <font color="green">Has contract with the publishing house</font>             {{else}}                 <font color="red">Without contract</font>             {{/if}}             <br />             <em> ${printMessage(state)} </em>             <br />                         </div>         </div>     </script>     <script language="javascript" type="text/javascript">         $(function () {             $.getJSON("GetAuthors", "", function (data) {                 $("#authorsTemplate").tmpl(data).appendTo("#authorsList");             });         });     </script> </head>     <body>     <div id="title">Pubs Authors</div>     <div id="authorsList"></div> </body> </html> So, in the complete example you also have the CSS style I’m using to stylize the output of my page. Here is print screen of the end result displayed on the web page: You can download the complete source code including examples shown in my previous blog posts about jQuery templates and PPT presentation from my last session I had in the local .NET UG meeting in the following DOWNLOAD LINK. Do let me know your feedback. Regards, Hajan

    Read the article

  • Daily tech links for .net and related technologies - Mar 26-28, 2010

    - by SanjeevAgarwal
    Daily tech links for .net and related technologies - Mar 26-28, 2010 Web Development Creating Rich View Components in ASP.NET MVC - manzurrashid Diagnosing ASP.NET MVC Problems - Brad Wilson Templated Helpers & Custom Model Binders in ASP.NET MVC 2 - gshackles The jQuery Templating Plugin and Why You Should Be Excited! - Chris Love Web Deployment Made Awesome: If You're Using XCopy, You're Doing It Wrong - Scott Hansleman Dynamic User Specific CSS Selection at Run Time - Misfit Geek Sending email...(read more)

    Read the article

  • jQuery Templates - {Supported Tags}

    - by hajan
    I have started with Introduction to jQuery Templates, then jQuery Templates - tmpl(), template() and tmplItem() functions. In this blog we will see what supported tags are available in the jQuery Templates plugin.Template tags can be used inside template together in combination with HTML tags and plain text, which helps to iterate over JSON data. Up to now, there are several supported tags in jQuery Templates plugin: ${expr} or {{= expr}} {{each itemArray}} … {{/each}} {{if condition}} … {{else}} … {{/if}} {{html …}} {{tmpl …}} {{wrap …}} … {{/wrap}}   - ${expr} or {{= expr}} Is used for insertion of data values in the rendered template. It can evaluate fields, functions or expression. Example: <script id="attendeesTemplate" type="text/html">     <li> ${Name} {{= Surname}} </li>         </script> Either ${Name} or {{= Surname}} (with blank space between =<blankspace>Field) will work.   - {{each itemArray}} … {{/each}} each is everywhere the same "(for)each", used to loop over array or collection Example: <script id="attendeesTemplate" type="text/html">     <li>         ${Name} ${Surname}         {{if speaker}}             (<font color="red">speaks</font>)         {{else}}             (attendee)         {{/if}}                 {{each phones}}                             <br />             ${$index}: <em>${$value}</em>         {{/each}}             </li> </script> So, you see we can use ${$index} and ${$value} to get the current index and value while iterating over the item collection. Alternatively, you can add index,value on the following way: {{each(i,v) phones}}     <br />     ${i}: <em>${v}</em> {{/each}} Result would be: Here is complete working example that you can run and see the result: <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server">     <title>Nesting and Looping Example :: jQuery Templates</title>     <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.min.js" type="text/javascript"></script>     <script src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.js" type="text/javascript"></script>     <script language="javascript" type="text/javascript">         $(function () {             var attendees = [                 { Name: "Hajan", Surname: "Selmani", speaker: true, phones:[070555555, 071888999, 071222333] },                 { Name: "Someone", Surname: "Surname", phones: [070555555, 071222333] },                 { Name: "Third", Surname: "Thirdsurname", phones: [070555555, 071888999, 071222333] },             ];             $("#attendeesTemplate").tmpl(attendees).appendTo("#attendeesList");         });     </script>     <script id="attendeesTemplate" type="text/html">         <li>             ${Name} ${Surname}             {{if speaker}}                 (<font color="red">speaks</font>)             {{else}}                 (attendee)             {{/if}}                     {{each(i,v) phones}}                 <br />                 ${i}: <em>${v}</em>             {{/each}}                 </li>     </script> </head> <body>     <ol id="attendeesList"></ol>     </body> </html>   - {{if condition}} … {{else}} … {{/if}} Standard if/else statement. Of course, you can use it without the {{else}} if you have such condition to check, however closing the {{/if}} tag is required. Example: {{if speaker}}     (<font color="red">speaks</font>) {{else}}     (attendee) {{/if}} You have this same code block in the above complete example showing the 'each' cycle ;).   - {{html …}} Is used for insertion of HTML markup strings in the rendered template. Evaluates the specified field on the current data item, or the specified JavaScript function or expression. Example: - without {{html …}} <script language="javascript" type="text/javascript">   $(function () {   var attendees = [             { Name: "Hajan", Surname: "Selmani", Info: "He <font color='red'>is the speaker of today's</font> session", speaker: true },         ];   $("#myTemplate").tmpl(attendees).appendTo("#speakers"); }); </script> <script id="myTemplate" type="text/html">     ${Name} ${Surname} <br />     ${Info} </script> Result: - with {{html …}} <script language="javascript" type="text/javascript">   $(function () {   var attendees = [             { Name: "Hajan", Surname: "Selmani", Info: "He <font color='red'>is the speaker of today's</font> session", speaker: true },         ];   $("#myTemplate").tmpl(attendees).appendTo("#speakers"); }); </script> <script id="myTemplate" type="text/html">     ${Name} ${Surname} <br />     {{html Info}} </script> Result:   - {{wrap …}} It’s used for composition and incorporation of wrapped HTML. It’s similar to {{tmpl}} Example: <script id="myTmpl" type="text/html">     <div id="personInfo">     <br />     ${Name} ${Surname}     {{wrap "#myWrapper"}}         <h2>${Info}</h2>         <div>             {{if speaker}}                 (speaker)             {{else}}                 (attendee)             {{/if}}         </div>     {{/wrap}}     </div> </script> <script id="myWrapper" type="text/html">     <table><tbody>         <tr>             {{each $item.html("div")}}                 <td>                     {{html $value}}                 </td>             {{/each}}         </tr>     </tbody></table> </script> All the HTMl content inside the {{wrap}} … {{/wrap}} is available to the $item.html(filter, textOnly) method. In our example, we have defined some standard template and created wrapper which calls the other template with id myWrapper. Then using $item.html(“div”) we find the div tag and render the html value (together with the div tag) inside the <td> … </td>. So, here inside td the <div> <speaker or attendee depending of the condition> </div>  will be rendered. The HTML output from this is:   - {{tmpl …}} Used for composition as template items Example: <script id="myTemplate" type="text/html">     <div id="bookItem">         <div id="bookCover">             {{tmpl "#bookCoverTemplate"}}         </div>         <div id="bookDetails">             <div id="book">                             ${title} - ${author}             </div>             <div id="price">$${price}</div>             <div id="Details">${pages} pgs. - ${year} year</div>         </div>     </div> </script> <script id="bookCoverTemplate" type="text/html">     <img src="${image}" alt="${title} Image" /> </script> In this example, using {{tmpl “#bookCoverTemplate”}} I’m calling another template inside the first template. In the other template I’ve created template for a book cover. The rendered HTML of this is: and   So we have seen example for each of the tags that are right now available in the jQuery Templates (beta) plugin which is created by Microsoft as a contribution to the open source jQuery Project. I hope this was useful blog post for you. Regards, HajanNEXT - jQuery Templates with ASP.NET MVC

    Read the article

  • Daily tech links for .net and related technologies - May 13-16, 2010

    - by SanjeevAgarwal
    Daily tech links for .net and related technologies - May 13-16, 2010 Web Development Integrating Twitter Into An ASP.NET Website Using OAuth - Scott Mitchell T4MVC Extensions for MVC Partials - Evan Building a Data Grid in ASP.NET MVC - Ali Bastani Introducing the MVC Music Store - MVC 2 Sample Application and Tutorial - Jon Galloway Announcing the RTM of MvcExtensions - kazimanzurrashid Optimizing Your Website For Speed Web Design Validation with the jQuery UI Tabs Widget - Chris Love A Brief History...(read more)

    Read the article

  • Help with an AJAX request

    - by sea_1987
    The Problem I am tring to do an ajax request to a PHP script, however I am having a problem getting the data into the format that the PHP is expecting it, the PHP is expecting the data to come in as array within an array something like, Array ( [cv_file] => Array ( [849649717] => Y [849649810] => Y ) [save] => Save CVs ) What have I tried? I have tried in my javascript to create an empty array and use that as the array key, something like this, var cv_file = new Array(); $(".drag_check").draggable({helper:"clone", opacity:"0.5"}); $(".searchPage").droppable({ accept:".drag_check", hoverClass: "dropHover", drop: function(ev, ui) { var droppedItem = ui.draggable.children(); cv_file = ui.draggable.children().attr('name'); var link = ui.draggable.children().attr('name').substr(ui.draggable.children().attr('name').indexOf("[")+1, ui.draggable.children().attr('name').lastIndexOf("]")-8) $.ajax({ type:"POST", url:"/search", data:cv_file+"&save=Save CVs", success:function(){ alert(cv_file) $('.shortList').append('<li><input type="checkbox" value="Y" class="checkbox" name="remove_cv['+link+']"/><a href="/cv/'+link+'">'+link+'</a></li>'); }, error:function() { alert("Somthing has gone wrong"); } }); } }); My Question How can I get the data into the format that the PHP is expecting, I would appreciate any help that anyone can give? Edit On alerting what the poster in the comments suggested I get he following, cv_file[849649717]&save=Save CVs Thank you

    Read the article

  • Using jQuery and AJAX works for all functions except one, really bizarre issue (from my perspective)

    - by CoreyT
    I am working on a classic asp form that has a number of dropdowns. Three of these are cascading, i.e. they rely in the previous dropdown. For almost everything this code works fine, one of them however is not playing nice. To start off I have a script tag with the following in it: $(document).ready(function () { $("#AcademicLevel").change(getList); $("#CourseDeliveryTime").change(updateLocation); $("#ProgramType").change(updateEntryTerm); }); This works just fine for the first two elements of the form, AcademicLevel and CourseDeliveryTime, the third however does not take effect however. If I use Firebug's Console and run that same line of code, $("#ProgramType").change(updateEntryTerm);, it starts to work, sort of. What happens is what confuses me. If the function it is pointing to, updateEntryTerm, has an alert() call in it, it works. If the alert is commented out, it does not work. The function is below: function updateEntryTerm() { $.ajax({ type: "POST", url: "../Classic ASP and AJAX/jQueryExample.asp", dataType: "application/x-www-form-urlencoded", data: "Action=UpdateEntryTerm&acadLevel=" + $("#AcademicLevel").val() + "&courseTime=" + $("#CourseDeliveryTime").val() + "&programType=" + $("#ProgramType").val(), async: false, success: function (msg) { $("#EntryTerm").remove(); $("#tdEntryTerm").append(msg); //alert(msg); } //, //error: function (xhr, option, err) { // alert("XHR Status: " + xhr.statusText + ", Error - " + err); //} }); } I am lost on two different issues here, First why is the call to $("#ProgramType").change(updateEntryTerm); not working unless I run it in Firebug Console? Second, why does the function itself, updateEntryTerm, not work unless the alert() call is present? Has anyone seem something like this before?

    Read the article

  • jQuery: Traversing AJAX response in Chrome/Safari

    - by jitzo
    I'm trying to traverse an AJAX response, which contains a remote web page (an HTML output). My goal is to iterate through the 'script', 'link', and 'title' elements of the remote page - load them if necessary, and embed its contents to the current page. Its working great in FF/IE, but for some reason - Chrome & Safari behaves differently: When I run a .each() loop on the response, Chrome/Safari seems to omit everything that is under the section of the page. Here's my current code: $.ajax({ url: 'remoteFile.php', cache: false, dataFilter: function(data) { console.log(data); /* The output seems to contain the entire response, including the <head> section - on all browsers, including Chrome/Safari */ $(data).filter("link, script, title").each(function(i) { console.log($(this)); /* IE/FF outputs all of the link/script/title elements, Chrome will output only those that are not in the <head> section */ }); console.log($(data)); /* This also outputs the incomplete structure on Chrome/Safari */ return data; }, success: function(response) {} }); I've been struggling with this problem for quite a while now, i've found some other similar cases on google searches, but no real solution. This happens on both jQuery 1.4.2, and jQuery 1.3.2. I really don't want to parse the response with .indexOf() and .substring() - it seems to me that it will be an overkill for the client. Many thanks in advance!

    Read the article

  • Jquery event to fire in ajax loaded content, IE & FF problem

    - by Sylph
    Hello, I'm trying to trigger onclick events in an ajax loaded content but it doesn't seem to work. Here is my code :- <li><a href="#" id="subtopic">Title</a></li> <script type="text/javascript"> $(function() { $("#subtopic").click(function() { url: test.html ,success: function(data) { $('#result').html(data); $(".filetree").treeview(); $('#result').click(); $('#result').trigger("update"); } }); }); }); </script> In my loaded content, :- <a href="#" id="addSubTopic">Click here</a> <script type="text/javascript"> $(document).ready(function() { alert("000"); }); $(function() { $("#addSubTopic").click(function() { alert("0"); $.ajax({ url: url, success: function(data) { $("#listRes").append(data); } }); }); }); </script> In IE, it works fine, the click works and I can get the "alert" but in Firefox, the whole thing just go dead. However, my jquery plugin for $(".filetree").treeview(); works fine for both IE and FF. Any advice? I have tried using .live, .trigger("update"). Thanks in advance

    Read the article

  • jQuery plugin Breaks after ajax call

    - by Jason
    Hello, I am quite a newbie to jQuery/ajax but am having a problem with my site that im making. Basically at first the page loads fine. On the boxes is a fade caption, when the title of the caption is clicked you are brought to an ajax page. Once you use the 'Back' button on browser, or the 'Back to list' button i've made the caption fade plugin no longer works and the box i had previously clicked is no longer clickable. can anyone help? heres my website: http://www.jcianfrone.com/testing jquery: h**p://www.jcianfrone.com/testing/script.js HTML: <div id="pageContent"> <div class="item"><a href="#page6"><img src="images/wrk-kd.jpg" width="286" height="200" alt="Koodikkki"></a><span id="caption"><a href="#">Title</a><p>Description</p></span></div> <div class="item"><a href="#page7"><img src="images/wrk-kd.jpg" width="286" height="200" alt="Koodikkki"></a><span id="caption"><a href="#">Title</a><p>Description</p></span></div> <div class="item"><a href="#page8"><img src="images/wrk-kd.jpg" width="286" height="200" alt="Koodikkki"></a><span id="caption"><a href="#">Title</a><p>Description</p></span></div> <div class="item"><a href="#page9"><img src="images/wrk-kd.jpg" width="286" height="200" alt="Koodikkki"></a><span id="caption"><a href="#">Title</a><p>Description</p></span></div> </div> Many thanks in advance

    Read the article

  • Problems with jQuery getJSON using local files in Chrome

    - by Tauren
    I have a very simple test page that uses XHR requests with jQuery's $.getJSON and $.ajax methods. The same page works in some situations and not in others. Specificially, it doesn't work in Chrome on Ubuntu. I'm testing on Ubuntu 9.10 with Chrome 5.0.342.7 beta and Mac OSX 10.6.2 with Chrome 5.0.307.9 beta. It works correctly when files are installed on a web server from both Ubuntu/Chrome and Mac/Chrome (try it out here). It works correctly when files are installed on local hard drive in Mac/Chrome (accessed with file:///...). It FAILS when files are installed on local hard drive in Ubuntu/Chrome (access with file:///...). The small set of 3 files can be downloaded in a tar/gzip file from here: http://issues.tauren.com/testjson/testjson.tgz When it works, the Chrome console will say: XHR finished loading: "http://issues.tauren.com/testjson/data.json". index.html:16Using getJSON index.html:21 Object result: "success" __proto__: Object index.html:22success XHR finished loading: "http://issues.tauren.com/testjson/data.json". index.html:29Using ajax with json dataType index.html:34 Object result: "success" __proto__: Object index.html:35success XHR finished loading: "http://issues.tauren.com/testjson/data.json". index.html:46Using ajax with text dataType index.html:51{"result":"success"} index.html:52undefined When it doesn't work, the Chrome console will show this: index.html:16Using getJSON index.html:21null index.html:22Uncaught TypeError: Cannot read property 'result' of null index.html:29Using ajax with json dataType index.html:34null index.html:35Uncaught TypeError: Cannot read property 'result' of null index.html:46Using ajax with text dataType index.html:51 index.html:52undefined Notice that it doesn't even show the XHR requests, although the success handler is run. I swear this was working previously in Ubuntu/Chrome, and am worried something got messed up. I already uninstalled and reinstalled Chrome, but that didn't help. Can someone try it out locally on your Ubuntu system and tell me if you have any troubles? Note that it seems to be working fine in Firefox.

    Read the article

  • jQuery Ajax (beforeSend and complete) working properly on FireFox but not on IE8 and Chrome

    - by Farhan Zia
    I am using jQuery ajax version 1.4.1 in my MVC application (though the issue I am discussing was same with the old jQuery version 3.2.1) as well, to check during customer registration if the username is already registered. As the user clicks on the "Check Availibility" button, I am showing a busy image in place of the check button (actually hiding the check button and showing the image) while checking the availibility on the server and then displaying a message. It is a Sync call (async: false) and I used beforeSend: and complete: to show and hide the busy image and the check button. This thing is working well on Firefox but in IE 8 and Chrome, neither the busy image appear nor the check button hides rather the check button remained pressed as the whole thing has hanged. The available and not available messages appear correctly though. Below is the code: HTML in a User Control (ascx): (i have replaced the angular braces with square below) [div id="available"]This Username is Available [div id="not_available"]This Username is not available [input id="txtUsername" name="txtUsername" type="text" size="50" /]  [button id="check" name="check" type="button"]Check Availability[/button] [img id="busy" src="/Content/Images/busy.gif" /] On the top of this user control, I am linking an external javascript file that has the following code: $(document).ready(function() { $('img#busy').hide(); $('div#available').hide(); $('div#not_available').hide(); $("button#check").click(function() { var available = checkUsername($("input#txtUsername").val()); if (available == "1") { $("div#available").show(); $("div#not_available").hide(); } else { $("div#available").hide(); $("div#not_available").show(); } }); }); function checkUsername(username) { $.ajax({ type: "POST", url: "/SomeController/SomeAction", data: { "id": username }, timeout: 3000, async: false, beforeSend: function() { $("button#check").hide(); $("img#busy").show(); }, complete: function() { $("button#check").show(); $("img#busy").hide(); }, cache: false, success: function(result) { return result; }, error: function(error) { $("img#busy").hide(); $("button#check").show(); alert("Some problems have occured. Please try again later: " + error); } }); }

    Read the article

  • Using will_paginate with AJAX live search with jQuery in Rails

    - by Mark Richman
    I am using will_paginate to successfully page through records. I am also using AJAX live search via jQuery to update my results div. No problem so far. The issue I have is when trying to paginate through those live search results. I simply get "Page is loading..." with no div update. Am I missing something fundamental? # index.html.erb <form id="searchform" accept-charset="utf-8" method="get" action="/search"> Search: <input id="search" name="search" type="text" autocomplete="off" title="Search location, company, description..." /> <%= image_tag("spinner.gif", :id => "spinner", :style =>"display: none;" ) %> </form> # JobsController#search def search if params[:search].nil? @jobs = Job.paginate :page => params[:page], :order => "created_at desc" elsif params[:search] and request.xhr? @jobs = Job.search params[:search], params[:page] end render :partial => "jobs", :layout => false, :locals => { :jobs => @jobs } end # Job#search def self.search(search, page) logger.debug "Job.paginate #{search}, #{page}" paginate :per_page => @@per_page, :page => page, :conditions => ["description LIKE ? or title LIKE ? or company LIKE ?", "%#{search}%", "%#{search}%", "%#{search}%"], :order => 'created_at DESC' end # search.js $(document).ready(function(){ $("#search").keyup(function() { $("#spinner").show(); // show the spinner var form = $(this).parents("form"); // grab the form wrapping the search bar. var url = form.attr("action"); // grab the URL from the form's action value. var formData = form.serialize(); // grab the data in the form $.get(url, formData, function(html) { // perform an AJAX get, the trailing function is what happens on successful get. $("#spinner").hide(); // hide the spinner $("#jobs").html(html); // replace the "results" div with the result of action taken }); }); });

    Read the article

  • jQuery dialog breaking after closing - I'm using dialog destroy

    - by pedalpete
    I've got a few demo videos I've been making as tutorials, and I'm using a link to open a dialog box and put the demo video in that box. I use the same div to show other notes on the page when a user selects to view a complete note. The code I use to show the notes is jQuery('span.Notes').live('click', function(){ var note=jQuery(this).data('note'); jQuery('div#showNote').text(note); jQuery('div#showNote').append(''); jQuery('div#showNote').dialog({ modal: true, close: function(){ jQuery('div#showNote').dialog('destroy').empty(); } }); }); The code I use for the demo videos is VERY similar. jQuery('a.demoVid').click(function(){ var videoUrl=jQuery(this).attr('href'); jQuery('div#showNote').dialog({ modal: true, height: 400, width: 480, close: function(){ jQuery('div#showNote').dialog('destroy').empty(); } }); swfobject.embedSWF(videoUrl,'showNote','480','390','8.0.0'); return false; }); I can click on as many notes as I want, and the dialog opens up and shows the note. However, when I click the demoVid, the dialog opens, but then closing the dialog kills any other 'showNote' dialogs on the page, so I can't open any more notes, or demo videos.

    Read the article

  • jQuery.ajax(): discard slow requests

    - by Thomas
    I've build a livesearch with the jQuery.ajax() method. On every keyup events it receives new result data from the server. The problem is, when I'm typing very fast, e.g. "foobar" and the GET request of "fooba" requires more time than the "foobar" request, the results of "fooba" are shown. To handle this with the timeout parameter is impossible, I think. Has anyone an idea how to solve this?

    Read the article

  • jquery get last ID of dynamic div

    - by Pjack
    Couldn't find an answer, but Im trying to get the last ID of the last div that was created on the page. The code I'm using doesn't seem to work using .last(). My syntax is probably wrong but I can't get it to show the ID. jQuery(document).ready(function() {jQuery("a.more_posts").live('click', function(event){ jQuery("div[id^='statuscontainer_']").last(); var id = parseInt(this.id.replace("statuscontainer_", "")); alert(id); }); });

    Read the article

  • Conflicts with jQuery and the ToolkitScirptManager?

    - by RUtt
    It just started experimenting with the ajax.net ToolkitScirptManager and it works fine but then I realized that it is breaking my ajax calls I'm doing using the jQuery library. I'm guessing that it is the issue with the $ symbol, does anyone have anythoughts on how to use both libraries. I don't want to use jquery's noconflict mode because we use other jquery plugins that I'm afraid won't work. Any thoughts?

    Read the article

  • jquery ajax post callback - manipulation stops after the "third" call

    - by shanyu
    EDIT: The problem is not related to Boxy, I've run into the same issue when I've used JQuery 's load method. EDIT 2: When I take out link.remove() from inside the ajax callback and place it before ajax load, the problem is no more. Are there restrictions for manipulating elements inside an ajax callback function. I am using JQuery with Boxy plugin. When the 'Flag' link on the page is clicked, a Boxy modal pops-up and loads a form via ajax. When the user submits the form, the link (<a> tag) is removed and a new one is created from the ajax response. This mechanism works for, well, 3 times! After the 3rd, the callback function just does not remove/replace/append (tested several variations of manipulation) the element. The only hint I have is that after the 3rd call, the parent of the link becomes non-selectable. However I can't make anything of this. Sorry if this is a very trivial issue, I have no experience in client-side programming. The relevant html is below: <div class="flag-link"> <img class="flag-img" style="width: 16px; visibility: hidden;" src="/static/images/flag.png" alt=""/> <a class="unflagged" href="/i/flag/showform/9/1/?next=/users/1/ozgurisil">Flag</a> </div> Here is the relevant js code: $(document).ready(function() { $('div.flag-link a.unflagged').live('click', function(e){ doFlag(e); return false; }); ... }); function doFlag(e) { var link = $(e.target); var url = link.attr('href'); Boxy.load(url, {title:'Inappropriate Content', unloadOnHide:true, cache:false, behaviours: function(r) { $("#flag-form").live("submit", function(){ var post_url = $("#flag-form").attr('action'); boxy = Boxy.get(this); boxy.hideAndUnload(); $.post(post_url, $("#flag-form").serialize(), function(data){ par = link.parent(); par.append(data); alert (par.attr('class')); //BECOMES UNDEFINED AT THE 3RD CALL!! par.children('img.flag-img').css('visibility', 'visible'); link.remove(); }); return false; }); }}); }

    Read the article

  • Saving elements to database with $.ajax()

    - by Justin Meltzer
    I'm trying to save dynamically created elements in my application.js file to the database. Would the code look something like this?: $.ajax({ type: "POST", data: { title: 'oembed.title', thumbnail_url: 'oembed.thumbnail_url'} }); Is there anything I'm missing? Assume that oembed.title and oembed.thubnail_url hold the values I want to save, and that title and thumbnail are the database columns.

    Read the article

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