There are a number of JavaScript issues going on here but I'm assuming you are excluding a bunch of code for brevity. Aside all the missing code, the two items that stand out here are the response export.php is sending along with not setting any headers for the content type you are handling, sending or receiving. Sticking with the receiving part since you are not sending any data, export.php is sending back a <script> trying to alert a value. It could just as easily send the value and the .success() portion of the AJAX request could handle that. e.g.: export.php header("Content-Type: text/plain"); echo "in php"; The POST request will receive that header and know how to handle the data: test.cfm var request = $.ajax( "export.php" ); request.done(function(data) { alert(data); }); // success, compatible with jQ 3.x+ request.fail(function( jqXHR, statusText ) { alert('Error: ' + statusText); }); // error, compatible with jQ 3.x+ Finally your try/catch has a return on the catch, "return err;". It's not inside a function so it has no place to return anything. You're also going after err.message which it's more useful to just alert(err) and not a specific property. Overall to get better feedback on what is going on, open your browsers developer panel (different way in each browser but for example in Chrome it's Triple Dot->More Tools->Developer Tools or CTRL+SHIFT+i on Windows for example). Inside this panel you can easily inspect values, better than alert(). There are a bunch of tabs across the top of the panel with different tools such as Elements, Sources, Console (where I'm referring to), etc.. If you open up Developer Tools and select the Console option, using the JS function console.log(anything) will output whatever you drop inside it into your console. Much better, complex objects, properties and values can be examined far easier than alert(). You can also type code directly in the console to give it a try, e.g. console.log(window); Try to use that on all the errors, data returned, data being sent, etc. It should help you diagnose things far easier.
... View more