IE Conditional Comment

When develop a website, you should take care of anything that IE can throw at you without the use of hacks. Hacks are dangerous, since they are based on non-standard exploits and you can’t trust how they’re going to behave on the future browsers. Thus the solution for this problem is the conditional stylesheet or conditional comment. One important thing is that IE 10 and up don’t support conditional comment

Conditional comment operators

Operator Description
IE represents Internet Explorer; if a number value is also
specified, it represents a version vector
lt less than operator
lte less than or equal to
gt greater than
gte greater than or equal to
! the NOT operator
() subexpression operator
& the AND operator
| the OR operator
true evaluates to true
false evaluates to false

Syntax

Target everything except IE

<!--[if !IE]>
  <link rel="stylesheet" type="text/css" href="not-ie.css" />
<![endif]-->

Target IE7 only

<!--[if IE 7]>
  <link rel="stylesheet" type="text/css" href="ie7.css" />
<![endif]-->

Target IE8 and lower

<!--[if lte IE 8]>
  <link rel="stylesheet" type="text/css" href="ie8.css" />
<![endif]-->

These conditional comments don’t have to be used only for CSS. You could load JavaScript, or even use them to display the specific content of your site.

Advertisements

Asynchronous And Synchronous Ajax Calls

In jQuery ajax call, there’s an option called async. Let’s look at below example:

$.ajax{(
    url: your_url,
    type: "POST",
    async: true,
    dataType: "json"
)}

By default, all requests are sent asynchronously(this is set to true by default). If you need synchronous requests, set this option to false
Setting async to false means that the statement you are calling has to complete before the next statement in your function call be called. If you set async to true then that statement will execute and the next statement will be called regardless of whether the async statement has completed yet.
Note that cross-domain requests and dataType: "jsonp"requests do not support synchronous operation. Also as of jQuery 1.8, the use of async: false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback options instead of the corresponding methods of the jqXHR object such as jqXHR.done() or the deprecated jqXHR.success().
Try something like this

$.ajax({
    url: target,
    contentType:'application/json; charset=utf-8',
    type: 'POST',
    dataType: 'json',
    async : false,
    success : function(){
        console.log();
    },
    error: function(){
        console.log();
    }
});