If you have access to PHP, I'd just throw up a script on your local server to request the headers of files on any server, and then just call that from your own domain using regular ajax calls, instead of jsonp. Jsonp doesn't actually make an ajax call, it includes a javascript file on the page, which is suposta be wrapped inside a function call that your local site knows how to handle.
Basically, jsonp isn't a way to get around cross-domain restrictions on AJAX, it's a way to integrate cross-browser data. Both your local jQuery page AND the request server need to be set up to communicate with each other. For instance, if you use jQuery to create a random jsonp function name (by passing ?callback=? as a url param), the destination server needs to be set up to look for a callback variable, and write a response using it. <?php echo $_REQUEST['callback'], '(', json_encode($data), ');'; ?> On Apr 22, 5:02 pm, Pete <peter.w...@gmail.com> wrote: > it's a regular url (www.somesite.com/somepdf.pdf) and it seems to be > adding that '?jsonp_callback=?' with the code i have above. > > I'm trying to do it without server-side script. > > Has anyone tried this? > > On Apr 22, 4:49 pm, James <james.gp....@gmail.com> wrote: > > > Oh, and to answer your question, I think when your results are not in > > the format specified for jsonp, regardless of whether the file exists > > or not it will still go to the error callback. > > By the way, what is the 'url' that you're using? Are you adding the '? > > callback=?' I've never tried this out, before though. > > > On Apr 22, 10:46 am, James <james.gp....@gmail.com> wrote: > > > > I personally suggest, instead, you set up a server-side script on your > > > own server that checks the remote file for you. Then you can use AJAX > > > to call that script to get the results. > > > > On Apr 22, 10:30 am, switch13 <peter.w...@gmail.com> wrote: > > > > > I'm trying to see if a pdf file exists in a directory on another > > > > server. If it does, do one thing, if not do another. > > > > > Here's what I tried: > > > > $.ajax({ > > > > url: url, > > > > type: 'GET', > > > > dataType: 'jsonp', > > > > jsonp:'jsonp_callback', > > > > error: function () { > > > > > > > > $('.Row').eq(i).children('td:eq(2)').append(file_unavail); > > > > }, > > > > success: function(){ > > > > > > > > $('.Row').eq(i).children('td:eq(2)').append(file_avail); > > > > } > > > > }); > > > > > I can get it to work on the same server by removing the dataType and > > > > jsonp but I was search around and read that the jsonp would allow me > > > > to get around the Access to restricted URI denied" code: "1012 > > > > > I'm I doing something wrong? Is it possible to do what I'm asking with > > > > jQuery?