Sending multipart/formdata with jQuery.ajax

Starting with Safari 5/Firefox 4, it’s easiest to use the FormData class: var data = new FormData(); jQuery.each(jQuery(‘#file’)[0].files, function(i, file) { data.append(‘file-‘+i, file); }); So now you have a FormData object, ready to be sent along with the XMLHttpRequest. jQuery.ajax({ url: ‘php/upload.php’, data: data, cache: false, contentType: false, processData: false, method: ‘POST’, type: ‘POST’, // … Read more

Official way to ask jQuery wait for all images to load before executing something

With jQuery, you use $(document).ready() to execute something when the DOM is loaded and $(window).on(“load”, handler) to execute something when all other things are loaded as well, such as the images. The difference can be seen in the following complete HTML file, provided you have a lot of jollyrogerNN JPEG files (or other suitable ones): … Read more

Get checkbox value in jQuery

To get the value of the Value attribute you can do something like this: $(“input[type=”checkbox”]”).val(); Or if you have set a class or id for it, you can: $(‘#check_id’).val(); $(‘.check_class’).val(); However this will return the same value whether it is checked or not, this can be confusing as it is different to the submitted form … Read more

check / uncheck checkbox using jquery? [duplicate]

For jQuery 1.6+ : .attr() is deprecated for properties; use the new .prop() function instead as: $(‘#myCheckbox’).prop(‘checked’, true); // Checks it $(‘#myCheckbox’).prop(‘checked’, false); // Unchecks it For jQuery < 1.6: To check/uncheck a checkbox, use the attribute checked and alter that. With jQuery you can do: $(‘#myCheckbox’).attr(‘checked’, true); // Checks it $(‘#myCheckbox’).attr(‘checked’, false); // Unchecks … Read more

Script Tag – async & defer

This image explains normal script tag, async and defer Async scripts are executed as soon as the script is loaded, so it doesn’t guarantee the order of execution (a script you included at the end may execute before the first script file ) Defer scripts guarantees the order of execution in which they appear in … Read more

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