I don't know if this is strictly a jquery issue or drupal's. I have an ajax call:
$.ajax({ type: 'get', url: URL, data: refined_url, dataType: 'html', success: function (data, textStatus, XMLHttpRequest) { document.getElementById('search_result_page').innerHTML = data; }, error:function (xhr, ajaxOptions, thrownError){ alert(xhr.status); alert(xhr.statusText); alert(xhr.responseText); } }); // end ajax method
The problem seems to be that the URL value used by ajax is a concatenation of the current directory and the URL value I supply. Say the URL I supply is 'sites/all/modules/mymodule/wrapper.php' (this is a concatenation of drupal_get_path('module', 'mymodule') and the wrapper.php file). Ajax wants to make it 'node/sites/all/modules/mymodule/wrapper.php'. This of course results in a 404 error.
I have checked the value of URL with alert(URL) immediately before the ajax call and the variable contains the correct value. Online documentation mentions that ajax uses the current directory by default. I want it to use the string I provide.