We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Can’t submit GET parameters in the URL

Development and Programming

sstoker's avatar
sstoker
10 posts
15 years ago
sstoker's avatar sstoker

Hi EEers,

I’ve had a few bumps in the road while upgrading to 2.1 from 1.6.8, but I’m almost done. I do have an issue I can’t resolve though. I can’t get any GET parameters to submit. Anytime I try to submit XMLHttpRequest with a parameter or try navigating to the page directly with parameters, I get a 404 error. If I remove the ? and all the parameters, I get a 200 response and the page loads. This same code worked perfectly in 1.6.8. Any ideas?

I’m using the Input class to pull the data out. It works well when I manually set the $_GET variable and assume it will work when I’m able to submit a request with GET parameters.

A few of the things I’ve tried that have failed: 1. Changing the $config[‘uri_protocol’] variable in my config.php file to PATH_INFO 2. Absolute paths 3. Cussing (for some reason this never works 😊)

Here is my code:

function loadXMLDoc(elementID, category)
    {
        if (window.XMLHttpRequest)
        {
            xmlhttp=new XMLHttpRequest();
        }
        else
        {
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function()
        {
            if (xmlhttp.readyState==4 && xmlhttp.status==200)
            {
                document.getElementById(elementID)[removed]=xmlhttp.responseText;
            }
        }
        xmlhttp.open("GET","clients/load-companies"+"?category="+category,true);
        xmlhttp.send();
    }

Thanks in advance!

       
chrcollins's avatar
chrcollins
77 posts
14 years ago
chrcollins's avatar chrcollins

Did you ever get an answer to this question?

       
the3mus1can's avatar
the3mus1can
426 posts
14 years ago
the3mus1can's avatar the3mus1can

Did you try $config[‘uri_protocol’] = ‘REQUEST_URI’; ?

       
chrcollins's avatar
chrcollins
77 posts
14 years ago
chrcollins's avatar chrcollins

Have not tried that.

My situation is a little different than the one described above. I am trying to do a .get using javascript but the result is the same. The file is not found because the get variables is confusing whatever is trying to determine the template being instantiated.

The following does not work …

$.get("{path=site/ajax_validate_conf_number}",
 {
   type: 'offer',
   trade_id: tid,
   conf_no: cno
 },
 function(data) {
  if (data == 'TRUE') {
    alert("Confiramtion Match - Trade is Complete!");
  } else {
    alert("Error - "+data);
  }        
});

If I change the .get to .post it works fine.

Note in the same javascript file I use the jquery .load which the jquery documentation says is essentially the same as a .get but actually works more like a .post as there is no get variables.

       
the3mus1can's avatar
the3mus1can
426 posts
14 years ago
the3mus1can's avatar the3mus1can

Can you also post here what is in your .htaccess file and any response output from the ajax requests from Firebug or Web Inspector?

       
chrcollins's avatar
chrcollins
77 posts
14 years ago
chrcollins's avatar chrcollins

My .htaccess file is minimal …

AddType x-mapp-php5 .php .php4

My config.php file is set as so ….

$config['uri_protocol']    = 'AUTO';

Here is the get as seen by firebug.  It returns a code of 200 (OK) and the reponse data consists of the contents of my index.html page.

http://mysite.us/index.php/site/ajax_validate_conf_number?type=offer&trade_id=254&conf_no=1234 <pre><code>

If I replace the .get with a .post it works fine.

Thanks for your help!

       
the3mus1can's avatar
the3mus1can
426 posts
14 years ago
the3mus1can's avatar the3mus1can

Can you try switching between $config[‘uri_protocol’] = ‘REQUEST_URI’ and $config[‘uri_protocol’] = ‘PATH_INFO’?

It looks like the templates are not getting routed properly and this is often the case with $config[‘uri_protocol’] = ‘AUTO’ as this first looks to the query strings to route the template.

       
chrcollins's avatar
chrcollins
77 posts
14 years ago
chrcollins's avatar chrcollins

Neither worked. Switching to PATH_INFO and I could not get off my home page. It looked like it was ignoring anything past the index.php in the url. REQUEST_URL actually parsed the url correctly but the .get returned a Server Error 500. “URI has invalid characters”.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.