Reputation: 2460
below code working fine but I need to append option1 in href,
$(document).ready(function () {
$("#head_drop .dd-option").click(function () {
var option = $('.dd-option-value',this).attr('value');
var option1 = $('.dd-option-text',this).text();
// alert(option1);
$.ajax({
type: 'get',
url: '<?php echo $this->getBaseUrl();?>categories/index/city/',
data: {option: option},
success: function(data) {
$(location).attr('href',"<?php echo $this->getBaseUrl()?>");
}
});
});
});
now its return
http://example.com/
I want like http://example.com/option1
I tried $(location).attr('href',"<?php echo $this->getBaseUrl()?>"option1);
but failed to get, Thanks...
Upvotes: 0
Views: 128
Reputation: 327
You have your "
at the wrong place, it should read:
$(location).attr('href',"<?php echo $this->getBaseUrl()?>option1");
Upvotes: 0
Reputation: 34416
If option1
is a variable all you need is to concatenate with a +
-
$(location).attr('href',"<?php echo $this->getBaseUrl()?>" + option1)
Upvotes: 5