Difference between $.ajax() and $.get() and $.load()

$.ajax() is the most configurable one, where you get fine grained control over HTTP headers and such. You’re also able to get direct access to the XHR-object using this method. Slightly more fine-grained error-handling is also provided. Can therefore be more complicated and often unecessary, but sometimes very useful. You have to deal with the … Read more

jQuery .scrollTop(); + animation

To do this, you can set a callback function for the animate command which will execute after the scroll animation has finished. For example: var body = $(“html, body”); body.stop().animate({scrollTop:0}, 500, ‘swing’, function() { alert(“Finished animating”); }); Where that alert code is, you can execute more javascript to add in further animation. Also, the ‘swing’ … Read more

Custom events in jQuery?

The link provided in the accepted answer shows a nice way to implement the pub/sub system using jQuery, but I found the code somewhat difficult to read, so here is my simplified version of the code: http://jsfiddle.net/tFw89/5/ $(document).on(‘testEvent’, function(e, eventInfo) { subscribers = $(‘.subscribers-testEvent’); subscribers.trigger(‘testEventHandler’, [eventInfo]); }); $(‘#myButton’).on(‘click’, function() { $(document).trigger(‘testEvent’, [1011]); }); $(‘#notifier1’).on(‘testEventHandler’, function(e, … Read more

How to enable CORS in flask

Here is what worked for me when I deployed to Heroku. http://flask-cors.readthedocs.org/en/latest/ Install flask-cors by running – pip install -U flask-cors from flask import Flask from flask_cors import CORS, cross_origin app = Flask(__name__) cors = CORS(app) app.config[‘CORS_HEADERS’] = ‘Content-Type’ @app.route(“https://stackoverflow.com/”) @cross_origin() def helloWorld(): return “Hello, cross-origin-world!”

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)