Skip Menu |

This queue is for tickets about the CGI-Ajax CPAN distribution.

Report information
The Basics
Id: 15080
Status: resolved
Priority: 0/
Queue: CGI-Ajax

People
Owner: Nobody in particular
Requestors: pavfed98 [...] yandex.ru
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.591
Fixed in: (no value)



Subject: Outside URL
Ajax seems not correctly determine URL when using outside script in situation when query string parameters were passed to original script. Consider snippet below: var l = ajax.length-1; var sep = '?'; if ( window.location.toString().indexOf('?') != -1) { sep = '&'; } if ( 'external_script.cgi' == '0') { ajax[l].url = window.location + sep + ajax[l].url; } else { ajax[l].url = 'external_script.cgi' + sep + ajax[l].url; } ajax[l].send2perl(); Here "sep" is overwritten if current window.location contains '?', but shoud not if 'external_script.cgi' is used. This leads to 404 Page Not Found when submitting URL of kind: external_url.cgi&fname=bla-bla...
From: pavfed98 [...] yandex.ru
Solution is straitforward, simply change the code in Ajax.pm: var l = ajax.length-1; var sep = '?'; var my_loc = ( \'$outside_url\' == '0' ? window.location.toString() : \'$outside_url\'); if ( my_loc.indexOf('?') != -1) { sep = '&'; }; ajax[l].url = my_loc + sep + ajax[l].url; Thanks, Pavel [guest - Sun Oct 16 08:45:41 2005]: Show quoted text
> Ajax seems not correctly determine URL when using outside script in > situation when query string parameters were passed to original script. > > Consider snippet below: > > var l = ajax.length-1; > var sep = '?'; > if ( window.location.toString().indexOf('?') != -1) { sep = '&'; } > if ( 'external_script.cgi' == '0') { > ajax[l].url = window.location + sep + ajax[l].url; > } else { > ajax[l].url = 'external_script.cgi' + sep + ajax[l].url; > } > ajax[l].send2perl(); > > Here "sep" is overwritten if current window.location contains '?', but > shoud not if 'external_script.cgi' is used. > This leads to 404 Page Not Found when submitting URL of kind: > external_url.cgi&fname=bla-bla...