#jQuery3
Explore tagged Tumblr posts
Text
jquery3.3.1 ajax postサンプル
jquery3.3.1 ajax postサンプル [javascript] $(‘#email’).change(function(){ var email = $(this).val();
$.post( "/store/smartbookstore/api/checkmail", { email: email }) .done(function( data ) { if(data){ $(‘#email’).val(”); swal("メールアドレス使用不可",email + " はすでに使用されています。","warning"); } });
}); [/javascript]
View On WordPress
0 notes
Text
Adding Bootstrap to a Rails App
Some older Rails tutorials or ones using cloud ide's running 4.2 recommend bootstrap-sass gem. "a Sass-powered version of Bootstrap 3, ready to drop right into your Sass powered applications". That was Bootstrap 3. For Bootstrap 4 use the Bootstrap ruby gem.
THE GEMS
gem 'bootstrap', '~> 4.2.1'
Bootstrap JavaScript depends on jQuery If you're using Rails 5.1+, add the jquery-rails gem to your Gemfile: gem 'jquery-rails'
bundle install and restart your server to make the files available through the pipeline.
CSS
If you have just generated a new Rails app, it may come with a .css file instead. If this file exists, it will be served instead of Sass, so rename it:
$ mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss
Then, remove all the *= require and *= require_tree statements from the Sass file. Instead, use @import to import Sass files.
The file should then contain depending on number of scss files.
They all need to be imported as we deleted require_tree which would bring them in automatically.
// Custom bootstrap variables must be set or imported *before* bootstrap.
@import "bootstrap";
@import "events";
@import "layout";
@import "show";
JAVASCRIPT
Bootstrap tooltips and popovers depend on popper.js for positioning. The bootstrap gem already depends on the popper_js gem. Add Bootstrap dependencies and Bootstrap to your application.js: above //= require tree . (pulls everything in from the js directory). //= require jquery3 //= require popper //= require bootstrap-sprockets
0 notes
Text
An Introduction to jQuery’s Deferred Objects
An Introduction to jQuery’s Deferred Objects
For a very long time, JavaScript builders have used callback features to carry out a number of duties. A quite common instance is so as to add a callback by way of the addEventListener() perform to execute numerous operations when an occasion, corresponding to click on or keypress, is fired. Callback features are easy and get the job carried out for easy instances. Sadly, when your net pages…
View On WordPress
0 notes