.htaccess with Array parameters (checkbox) and three others. GET method
up vote
0
down vote
favorite
I have been tried to get this to work for a while now.
I am doing a web app where I would like to to have the web URL be example.net/param/param/param/param etc.
I have successfully did it this one of my pages here:
RewriteCond %REQUEST_FILENAME -s [OR]
RewriteCond %REQUEST_FILENAME -l [OR]
RewriteCond %REQUEST_FILENAME -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*)$ /i/index.php?id=$1 [NC,L]
This takes example.com/i?id=1212112
and turns it into example.com/i/1212112
.
However, I have another directory, results, that gets a POST from domain.com (index). I have a form inside of results that gets information via AJAX call and builds out a form. That code is below.
<script>
$(document).on('change', 'select', function()
var itemSpecifics = document.getElementById('itemSpecifics');
var submitButton = document.getElementById('submitButton');
var narrowHelper = document.getElementById('narrowHelper');
narrowHelper.innerHTML = "select all of the filters you want to search by.";
var loading = document.getElementById('loading');
loading = loading.style.display = "block";
document.getElementById("submitButton").style.display = "none";
//$("#submitButton").empty();
$("#itemSpecifics").empty();
$.ajax(
type : 'GET',
url : 'refine_search.php',
data: category: $(this).val(),
cache: false,
dataType : 'json',
encode : true,
traditional: true,
success: function (response, status, xhr)
console.log(response);
for (var i = 0; i < response.length; i++)
console.log(response[i].name);
itemSpecifics.innerHTML += "<div style="color:#ec5b6e">" + response[i].name + "</div>";
//console.log(response[i].value);
for (var j = 0; j < response[i].value.length; j++)
console.log("-- " + response[i].value[j].value);
var checkbox = document.createElement('input');
checkbox.type = "checkbox";
checkbox.name = "cb";
checkbox.value = response[i].name + "@" + response[i].value[j].value;
checkbox.id = "checkboxid";
var label = document.createElement('label')
label.htmlFor = "id";
label.id = "label";
label.appendChild(document.createTextNode(response[i].value[j].value));
itemSpecifics.appendChild(checkbox);
itemSpecifics.innerHTML += " ";
itemSpecifics.appendChild(label);
itemSpecifics.innerHTML += "<br>";
$("input[type='checkbox']").on('change', function()
console.log($(this).val());
);
submitButton.innerHTML = "SUBMIT";
document.getElementById("loading").style.display = "none";
document.getElementById("submitButton").style.display = "block";
,
error: function (xhr, status, error)
console.log(error);
);
// if you want to do stuff based on the OPTION element:
var opt = $(this).find('option:selected')[0];
// use switch or if/else etc.
);
</script>
This spits out A LOT of checkboxes and labels. When they are selected, I grab the value and save it in the cb array for the name of the checkbox. For form has this.
<form action="example.net/results" method="GET">
When this form is submitted, I get this...
https://www.example.com/results/?cb%5B%5D=Model%40Xbox+360+Arcade&cb%5B%5D=Model%40Xbox+360+Core&cb%5B%5D=Model%40Xbox+360+E&cb%5B%5D=Model%40Xbox+360+Elite
What I would LOVE to be able to do, is to route that above URL to...
https://www.example.com/results/Model%40Xbox+360+Arcade/Model%40Xbox+360+Core/Model%40Xbox+360+E/Model%40Xbox+360+Elite
OR, removing the &cb%5B%5D=
Can anyone help me with that? I tried doing a POST method for the form, but when I do that, the code only grabs the last cb= and then only the first character of the string.
php ajax .htaccess
add a comment |
up vote
0
down vote
favorite
I have been tried to get this to work for a while now.
I am doing a web app where I would like to to have the web URL be example.net/param/param/param/param etc.
I have successfully did it this one of my pages here:
RewriteCond %REQUEST_FILENAME -s [OR]
RewriteCond %REQUEST_FILENAME -l [OR]
RewriteCond %REQUEST_FILENAME -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*)$ /i/index.php?id=$1 [NC,L]
This takes example.com/i?id=1212112
and turns it into example.com/i/1212112
.
However, I have another directory, results, that gets a POST from domain.com (index). I have a form inside of results that gets information via AJAX call and builds out a form. That code is below.
<script>
$(document).on('change', 'select', function()
var itemSpecifics = document.getElementById('itemSpecifics');
var submitButton = document.getElementById('submitButton');
var narrowHelper = document.getElementById('narrowHelper');
narrowHelper.innerHTML = "select all of the filters you want to search by.";
var loading = document.getElementById('loading');
loading = loading.style.display = "block";
document.getElementById("submitButton").style.display = "none";
//$("#submitButton").empty();
$("#itemSpecifics").empty();
$.ajax(
type : 'GET',
url : 'refine_search.php',
data: category: $(this).val(),
cache: false,
dataType : 'json',
encode : true,
traditional: true,
success: function (response, status, xhr)
console.log(response);
for (var i = 0; i < response.length; i++)
console.log(response[i].name);
itemSpecifics.innerHTML += "<div style="color:#ec5b6e">" + response[i].name + "</div>";
//console.log(response[i].value);
for (var j = 0; j < response[i].value.length; j++)
console.log("-- " + response[i].value[j].value);
var checkbox = document.createElement('input');
checkbox.type = "checkbox";
checkbox.name = "cb";
checkbox.value = response[i].name + "@" + response[i].value[j].value;
checkbox.id = "checkboxid";
var label = document.createElement('label')
label.htmlFor = "id";
label.id = "label";
label.appendChild(document.createTextNode(response[i].value[j].value));
itemSpecifics.appendChild(checkbox);
itemSpecifics.innerHTML += " ";
itemSpecifics.appendChild(label);
itemSpecifics.innerHTML += "<br>";
$("input[type='checkbox']").on('change', function()
console.log($(this).val());
);
submitButton.innerHTML = "SUBMIT";
document.getElementById("loading").style.display = "none";
document.getElementById("submitButton").style.display = "block";
,
error: function (xhr, status, error)
console.log(error);
);
// if you want to do stuff based on the OPTION element:
var opt = $(this).find('option:selected')[0];
// use switch or if/else etc.
);
</script>
This spits out A LOT of checkboxes and labels. When they are selected, I grab the value and save it in the cb array for the name of the checkbox. For form has this.
<form action="example.net/results" method="GET">
When this form is submitted, I get this...
https://www.example.com/results/?cb%5B%5D=Model%40Xbox+360+Arcade&cb%5B%5D=Model%40Xbox+360+Core&cb%5B%5D=Model%40Xbox+360+E&cb%5B%5D=Model%40Xbox+360+Elite
What I would LOVE to be able to do, is to route that above URL to...
https://www.example.com/results/Model%40Xbox+360+Arcade/Model%40Xbox+360+Core/Model%40Xbox+360+E/Model%40Xbox+360+Elite
OR, removing the &cb%5B%5D=
Can anyone help me with that? I tried doing a POST method for the form, but when I do that, the code only grabs the last cb= and then only the first character of the string.
php ajax .htaccess
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have been tried to get this to work for a while now.
I am doing a web app where I would like to to have the web URL be example.net/param/param/param/param etc.
I have successfully did it this one of my pages here:
RewriteCond %REQUEST_FILENAME -s [OR]
RewriteCond %REQUEST_FILENAME -l [OR]
RewriteCond %REQUEST_FILENAME -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*)$ /i/index.php?id=$1 [NC,L]
This takes example.com/i?id=1212112
and turns it into example.com/i/1212112
.
However, I have another directory, results, that gets a POST from domain.com (index). I have a form inside of results that gets information via AJAX call and builds out a form. That code is below.
<script>
$(document).on('change', 'select', function()
var itemSpecifics = document.getElementById('itemSpecifics');
var submitButton = document.getElementById('submitButton');
var narrowHelper = document.getElementById('narrowHelper');
narrowHelper.innerHTML = "select all of the filters you want to search by.";
var loading = document.getElementById('loading');
loading = loading.style.display = "block";
document.getElementById("submitButton").style.display = "none";
//$("#submitButton").empty();
$("#itemSpecifics").empty();
$.ajax(
type : 'GET',
url : 'refine_search.php',
data: category: $(this).val(),
cache: false,
dataType : 'json',
encode : true,
traditional: true,
success: function (response, status, xhr)
console.log(response);
for (var i = 0; i < response.length; i++)
console.log(response[i].name);
itemSpecifics.innerHTML += "<div style="color:#ec5b6e">" + response[i].name + "</div>";
//console.log(response[i].value);
for (var j = 0; j < response[i].value.length; j++)
console.log("-- " + response[i].value[j].value);
var checkbox = document.createElement('input');
checkbox.type = "checkbox";
checkbox.name = "cb";
checkbox.value = response[i].name + "@" + response[i].value[j].value;
checkbox.id = "checkboxid";
var label = document.createElement('label')
label.htmlFor = "id";
label.id = "label";
label.appendChild(document.createTextNode(response[i].value[j].value));
itemSpecifics.appendChild(checkbox);
itemSpecifics.innerHTML += " ";
itemSpecifics.appendChild(label);
itemSpecifics.innerHTML += "<br>";
$("input[type='checkbox']").on('change', function()
console.log($(this).val());
);
submitButton.innerHTML = "SUBMIT";
document.getElementById("loading").style.display = "none";
document.getElementById("submitButton").style.display = "block";
,
error: function (xhr, status, error)
console.log(error);
);
// if you want to do stuff based on the OPTION element:
var opt = $(this).find('option:selected')[0];
// use switch or if/else etc.
);
</script>
This spits out A LOT of checkboxes and labels. When they are selected, I grab the value and save it in the cb array for the name of the checkbox. For form has this.
<form action="example.net/results" method="GET">
When this form is submitted, I get this...
https://www.example.com/results/?cb%5B%5D=Model%40Xbox+360+Arcade&cb%5B%5D=Model%40Xbox+360+Core&cb%5B%5D=Model%40Xbox+360+E&cb%5B%5D=Model%40Xbox+360+Elite
What I would LOVE to be able to do, is to route that above URL to...
https://www.example.com/results/Model%40Xbox+360+Arcade/Model%40Xbox+360+Core/Model%40Xbox+360+E/Model%40Xbox+360+Elite
OR, removing the &cb%5B%5D=
Can anyone help me with that? I tried doing a POST method for the form, but when I do that, the code only grabs the last cb= and then only the first character of the string.
php ajax .htaccess
I have been tried to get this to work for a while now.
I am doing a web app where I would like to to have the web URL be example.net/param/param/param/param etc.
I have successfully did it this one of my pages here:
RewriteCond %REQUEST_FILENAME -s [OR]
RewriteCond %REQUEST_FILENAME -l [OR]
RewriteCond %REQUEST_FILENAME -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*)$ /i/index.php?id=$1 [NC,L]
This takes example.com/i?id=1212112
and turns it into example.com/i/1212112
.
However, I have another directory, results, that gets a POST from domain.com (index). I have a form inside of results that gets information via AJAX call and builds out a form. That code is below.
<script>
$(document).on('change', 'select', function()
var itemSpecifics = document.getElementById('itemSpecifics');
var submitButton = document.getElementById('submitButton');
var narrowHelper = document.getElementById('narrowHelper');
narrowHelper.innerHTML = "select all of the filters you want to search by.";
var loading = document.getElementById('loading');
loading = loading.style.display = "block";
document.getElementById("submitButton").style.display = "none";
//$("#submitButton").empty();
$("#itemSpecifics").empty();
$.ajax(
type : 'GET',
url : 'refine_search.php',
data: category: $(this).val(),
cache: false,
dataType : 'json',
encode : true,
traditional: true,
success: function (response, status, xhr)
console.log(response);
for (var i = 0; i < response.length; i++)
console.log(response[i].name);
itemSpecifics.innerHTML += "<div style="color:#ec5b6e">" + response[i].name + "</div>";
//console.log(response[i].value);
for (var j = 0; j < response[i].value.length; j++)
console.log("-- " + response[i].value[j].value);
var checkbox = document.createElement('input');
checkbox.type = "checkbox";
checkbox.name = "cb";
checkbox.value = response[i].name + "@" + response[i].value[j].value;
checkbox.id = "checkboxid";
var label = document.createElement('label')
label.htmlFor = "id";
label.id = "label";
label.appendChild(document.createTextNode(response[i].value[j].value));
itemSpecifics.appendChild(checkbox);
itemSpecifics.innerHTML += " ";
itemSpecifics.appendChild(label);
itemSpecifics.innerHTML += "<br>";
$("input[type='checkbox']").on('change', function()
console.log($(this).val());
);
submitButton.innerHTML = "SUBMIT";
document.getElementById("loading").style.display = "none";
document.getElementById("submitButton").style.display = "block";
,
error: function (xhr, status, error)
console.log(error);
);
// if you want to do stuff based on the OPTION element:
var opt = $(this).find('option:selected')[0];
// use switch or if/else etc.
);
</script>
This spits out A LOT of checkboxes and labels. When they are selected, I grab the value and save it in the cb array for the name of the checkbox. For form has this.
<form action="example.net/results" method="GET">
When this form is submitted, I get this...
https://www.example.com/results/?cb%5B%5D=Model%40Xbox+360+Arcade&cb%5B%5D=Model%40Xbox+360+Core&cb%5B%5D=Model%40Xbox+360+E&cb%5B%5D=Model%40Xbox+360+Elite
What I would LOVE to be able to do, is to route that above URL to...
https://www.example.com/results/Model%40Xbox+360+Arcade/Model%40Xbox+360+Core/Model%40Xbox+360+E/Model%40Xbox+360+Elite
OR, removing the &cb%5B%5D=
Can anyone help me with that? I tried doing a POST method for the form, but when I do that, the code only grabs the last cb= and then only the first character of the string.
php ajax .htaccess
php ajax .htaccess
edited Nov 10 at 12:19
lgwilliams
159212
159212
asked Nov 10 at 12:13
DroiDev
1,4181315
1,4181315
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53238831%2fhtaccess-with-array-parameters-checkbox-and-three-others-get-method%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password