天道酬勤,学无止境

ajax

Ajax submit various input values with jquery UI next button click

I am currently working with jquery ui tabs and ajax/post submit without page refresh. With some guidance I have been able to get the div #wmd-preview submited when clicking the next button. The issue is that I also have other fields I will like to submit at the same time when the next button is clicked in various tabs. How can I submit the input values of various input fields in different tabs when clicking the next button? EXAMPLE (for some testing i currently have the other input fields submit with keyup and timer setup) JS- NEXT/Previous button merged with submit/ajax <script> var

2021-07-13 17:34:01    分类:问答    javascript   jquery   ajax

Send javascript variables to rails?

I need to seed a javascript variable to the controller. For example, if my code in the view is the following - ... <script type="text/javascript"> variable_test = 'hello' </script> ... I need the controller to get variable_test , like - def hello @variable_test = #Some code # @variable_test => 'hello' end The view is hello of course, and 'Some code' is what I don't know how to do.

2021-07-13 17:28:41    分类:问答    javascript   ruby-on-rails   ajax

jQuery Address: Certify that user is pressing forward button and not back button

EDIT 3: This jsFiddle works with the plugin, I almost have it. EDIT 2: I made a fiddle.I can't get the plugin to work there, but maybe it is easier to analyze. In the webpage I am building, Articles(posts) and new Pages are loaded via Ajax. At the same time when new Ajax-content is loaded, the address bar changes (using jQuery Address plugin). So a normal navigation would go like this: / /page2 /page3 /article7 /page3 /page4 Please note that in this navigation, no browser button was pressed, when exiting the article7 the website goes back to its prior url which is page3 in this case. The

2021-07-13 16:20:28    分类:问答    jquery   ajax   browser-history   jquery-address

Use jQuery to check if links still work

I made a quick function to check every link on the page using AJAX to see if they still work. This seems to be working, but it's adding the success and error class to every one. How can I get the error callback function to only throw if the AJAX response is 404? $('li').each(function(){ $(this).children('a').each(function(){ $.ajax({ url:$(this).attr('src'), success:$(this).addClass('success'), error:$(this).addClass('error') }) }) });

2021-07-13 15:35:55    分类:问答    javascript   jquery   ajax   http-status-code-404

Hook and change ajax request

I'm new the JQuery. I am using a closed framework, that allows me to add code, but not to change some of the behavior. In order to add functionality, I need to hook into a specific Ajax request and either redirect it to my URL (so i can change the data there and be a proxy), or change the parameters of the request at the client side. Is this possible with JQuery? And if so, how? The original event is fired after a text input box is being updated. Update: After further inspection, it seems the textbox is manipulated using the JQuery Autocomplete plugin. I am trying to translate the words

2021-07-13 15:25:49    分类:问答    jquery   ajax   proxy

jQuery preventDefault() not working inside AJAX call

So, I am doing a check when a user inputs an email to see if the email exists or not. $('form.recover-form#check-form').on('submit', function(e){ var form = $(this), input = $('.check-recover-email'), span = $('.recover-error'), email = input.val(); span.text(''); e.preventDefault(); $.ajax({ url: 'ajax/check-email', async: 'false', cache: 'false', type: 'POST', data: {email: email}, success: function(response) { if ( response == 'no' ) { span.text('email does not exist'); } else if ( response == 'ok' ) { form.submit(); } } }); }); The php code if ( Input::isPost('email') ) { $email = Input

2021-07-13 13:23:51    分类:问答    php   jquery   ajax   preventdefault

Lock the screen with a popup till the time page gets loaded completely

My page takes quite sometime to load a variety of controls and menu images. I want to show a popup window with progress bar on it. The user must not be able to access the original page on the web-browser when this popup is showing. When the page has loaded completely, this popup must disappear. How to do this?

2021-07-13 13:12:22    分类:问答    javascript   html   ajax

Plone5 Mockup Widgets like pat-pickadate not working for dynamically generated content

Assume the following silly code fragment in a plone 5 page template: <input id="foo" class="pat-pickadate" /> <input id="bar" /> <script type="text/javascript" > $('#bar').click( function () { $('#bar').addClass("pat-pickadate"); }); </script> You will get two inputs. The first is a nice calendar input and the second is empty at start. After clicking the second input its class will be set to "pat-pickadate" - like the first - but no calendar is rendered. I came across this while trying to find the reason, why my jquery-UI overlays displaying plone add, and edit views do no longer (Plone5) show

2021-07-13 12:42:41    分类:问答    javascript   ajax   requirejs   plone   plone-5.x

FireFox and AjaxControlToolKit Combobox

I'm using the .NET framework 4.0 and the corresponding version of the Ajax control toolkit. On my page I have a combobox defined like this: <asp:ComboBox ID="cbUserName" AutoCompleteMode="SuggestAppend" CaseSensitive="false" runat="server" BackColor="#FFFFCC"> </asp:ComboBox> In IE9 the combobox allows me to either type in it or select from the list of users. In FireFox, however, it's not letting me type in the box. The dropdownlist also doesn't filter when I'm typing in FireFox either. I'm wondering if anyone else has seen this behavior, and if there's a work-around? EDIT For what it's worth

2021-07-13 12:30:01    分类:问答    asp.net   ajax

How to update partial view from another partial view via action results

I have three partial views on main view on the first partial view I have search functionality and when user clicks on search I want to refresh results into 3rd partial view. Controller: public ActionResult Search() { virtualmodel vm = new virtualmodel(); return PartialView(svm); } [HttpPost] public ActionResult Search(ViewModel svm) { // Query to retrive the result // I am not sure what to return from here. Link to another action or just return back to same same partial } public ActionResult AnotherPartialPartial() { } In main view @{Html.RenderAction("Search", "Searchc"); } How to do it? Do I

2021-07-13 12:17:12    分类:问答    c#   ajax   asp.net-mvc   asp.net-mvc-4   partial-views