ajax

trying to auto submit form after text input

爷,独闯天下 提交于 2021-01-28 11:51:44
问题 Here is how the form is supposed to execute: <script> $(document).ready(function(){ $("#submit").click(function(){ //access token stuff var token = $("#link_input").val(); ... etc</script> . I am trying to auto submit this info once it exceeds 10 characters. Normally you fill out the text area in the input field and you click submit. Upon clicking the submit button the JS validates the text in the input box and if it's valid it executes. How can I auto-submit the text in the input box without

How to show all parent and child values in one select dropdown in javascript

北城以北 提交于 2021-01-28 11:44:58
问题 Hi guys i have topic table where i am storing all topics along with sub topics..and subtopic id i am storing in parent_id column. Here is my db structure: i am getting all topics in dropdown like this. But i would like to show my subtopics list like this fractions fractions>introductions to fractions fractions>Fractions as division So far i have create childTopics functions in my model: public function childTopics() { return $this->hasMany(Topic::class, 'parent_id'); } And i used in my create

How to use one ajax datasource with multiple JQuery Datatables

旧巷老猫 提交于 2021-01-28 11:12:14
问题 There are two datatables on the same page and both have different columns. Is there a way to use the same ajax datasource to draw multiple tables? I am trying avoid multiple calls to database. $('#gvData').DataTable({ "processing": true, //"serverSide": true, "bPaginate": false, "bFilter": false, "bInfo": false, "scrollY": "300px", "scrollCollapse": true, "bDestroy": true, "ajax": { "dataType": 'json', "contentType": "application/json", "type": "POST", "url": "myform.aspx/GetData", "data":

Rails - pass a parameter to controller from form select dropdown

不打扰是莪最后的温柔 提交于 2021-01-28 10:40:45
问题 I have 2 models: Team and Quest . When creating a new team, I have a drop-down of all the quests. When a quest is selected, I want to display information about the quest. My understanding is that everything in the form is on the client side and AJAX is required to pass the selected quest to the server side. My code is based on this Stack Overflow answer. Here is how I constructed my form: app/views/teams_form.html.erb <%= form_for(@team) do |f| %> <fieldset> <ol> <li> <%= f.label :name %> <%=

AJAX Request from 3 URLS to Populate Same Table

荒凉一梦 提交于 2021-01-28 10:13:03
问题 Is it possible to have 3 different AJAX requests, and have them all populate to the same DataTable(table)? I have tried and tried to create a AJAX with multiple URLS and it didn't work, but when I used just one URL, it works fine. The issue is I need to pull from three different subsites. Here is my code: $(document).ready(function() { $('#myTable').DataTable({ 'ajax': { 'url': "_api/web/lists/getbytitle('XDeliverables')/items?$select=Program, Deliverable, To, Date, Approved, Notes", 'headers

Why doesn't work rack-cors?

风格不统一 提交于 2021-01-28 09:16:02
问题 config/application.rb require_relative 'boot' require 'rails/all' Bundler.require(*Rails.groups) module MyApp class Application < Rails::Application config.middleware.insert_before ActionDispatch::Static, Rack::Cors do allow do origins '*' resource '*', :headers => :any, :methods => [:get, :post, :options, :patch, :delete] end end end end Gemfile gem 'rack-cors', :require => 'rack-cors' another gems… bundle exec rake middleware use Rack::Cors another middleware… This is an error shown console

Codeigniter Ajax gets 404 Error

不打扰是莪最后的温柔 提交于 2021-01-28 09:12:59
问题 I wrote an application on my local machine that works perfectly. I am using XAMPP so it is running Apache. When I uploaded the application to my ubuntu test server, I am getting a 404 error on the ajax call and I am honestly perplexed. I am using CodeIgniter 3.1.8. The controller is definitely there and the .htaccess is working fine on my local machine. I checked the case of the filename for the controller and it is fine. Here's the javascript of the ajax call: function step2(){ var canShow =

ajax changes target attribute on multipart/form-data form

浪子不回头ぞ 提交于 2021-01-28 08:34:10
问题 When I try to render a component with f:ajax inside a multipart/form-data form, the target attribute of the form gets changed to JSFFrameId . Is this a bug? Here is a sample code when this occur: <h:form enctype="multipart/form-data"> <h:inputText> <f:ajax event="change" render="@this" execute="@this"/> </h:inputText> <h:inputFile /> </h:form> In my real code this is not what I'm trying to do but the same issue occurs with the sample code. When visiting this page I get the following HTML

POST with Jquery and receive a response from Node.js

…衆ロ難τιáo~ 提交于 2021-01-28 08:20:58
问题 I'm trying to do something very simple, I want to do a POST with AJAX Jquery to a Node.js server and have the server return a response. My problem is that I can't get that answer from the server. If someone can help me, I will be very grateful. client.js $(document).ready(function(){ $("button").click(function(){ $.post("http://localhost:3333/vrp", { name: "Donald Duck", city: "Duckburg" }, function(data,status){ alert("Data: " + data + "\nStatus: " + status); //This section code doesn't

How to use javascript promises ES6 instead of jQuery ajax call?

感情迁移 提交于 2021-01-28 08:11:47
问题 I was trying to understand how promises works in javascript but I didn't found clear info about this, I would like to know if it possible and it is so how to do this using promises instead this code (equivalent) $.ajax({ type: 'post', cache: false, url: 'myfile.php', data: { info: info }, datatype: 'json', success: function(response) { console.log(response); } }); I ask this because I want to use only javascript without any framework or plugins, I have no problem with the other new feautures