javascript - How to check if an AJAX response has HTML contents in jQuery? -


i have page 1 form , 2 possible responses in event of successful ajax call, 1 of returns status code.

what need check response object in success callback html contents can display them on page.

i know can access response in callback adding parameter, so:

function success(response) { }

the thing can't figure out how check if object has html contents. how can this?

you want @ response headers html mime type. $.ajax pass jqxhr object success callback, can call .getresponseheader() on:

function success( response, status, jqxhr ) {     if( jqxhr.getresponseheader('content-type').indexof('text/html') >= 0 ) {         ...     } } 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -