what is the alternative to cfajaxproxy in jquery
# cfml-general
g
what is the alternative to cfajaxproxy in jquery
r
I don't use cfajaxproxy, so I may not be correct here, but I use
ajax()
method in jQuery. https://api.jquery.com/jquery.ajax/
g
So is it the replacement I should seek
Same is with cfajaximport
r
Here is an example of a recently created ajax I use to call a CFC method.
Copy code
$.ajax({
		url: '/modules/labelview/labelview.cfc',
		type: 'get',
		dataType: 'json',
		data: {"method":"export"},
		success: exportSuccess
	});
exportSuccess
is user-defined function to handle the success response, which is the following:
Copy code
function exportSuccess(data) {
	data = JSON.parse(data);
	fileExists("/#filename#").then(function(yes){
		if (data && yes) {
			$('##waiting').hide(); 
			$('##download').show();
			return true;
		} else {
			$('##waiting img').hide(); 
			$('##waiting-content').html('Something went wrong. Please refresh this page to try again.');
			return false;
		}
	});
}
There are double pounds in there because the javascript is wrapped with <cfoutput> tags in this particular code.
The gist of the functionality is creating a download link for an internal application.