Reputation: 539
Sending the value of the select option is not working but I am able to get the value and print it, so it's definitely the $.get
.
$(document).ready(function () {
//hover method to drop down nav menu
.
.
.
.
$('select').change( function() {
var val = $('#sortOpt').val();
$.get(
"http://localhost/e-com/index.php/products/categories?cat=cameras&",
{
sort: val
},
function(data){}
)
});
});
Upvotes: 0
Views: 37
Reputation: 5517
You should send data as url parameters:
$.get(
"http://localhost/e-com/index.php/products/categories?cat=cameras&sort=" + val,
function(data){}
});
Upvotes: 0
Reputation: 2511
You need to fix the following :
var val = $('#sortOpt').val();
//^remove the '$'
You've also got an extra }
at the end of your $.get()
call.
Once fixed, you should have:
$('select').change( function() {
var val = $('#sortOpt').val();
$.get(
"http://localhost/e-com/index.php/products/categories?cat=cameras&",
{
sort: val
},
function(data){}
);
});
Upvotes: 1