I could not get my javascript code to submit an get request using ajax in Elementor. I figured out that my search form was in a popup and not in the DOM until the popup was active. So when trying to attach and add the submit event, it never worked.
I’m sure there is another way but the quickest solutions I found was to use the jQuery ‘on’ function with delegation. So instead of attaching to the submit event directly like this:
$('form.elementor-search-form').on('submit', function {
//do my stuff here
});
I did the following:
$('body').on('submit', 'form.elementor-search-form', function(e) {
//do my stuff here
});