1
I have the following code from button
:
<button type="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('View all items in your shopping cart')) ?>" class="button btn-inline-ver-carrinho" onclick="setLocation('<?php echo $this->getUrl('checkout/cart') ?>')"><span><span>Ver Carrinho</span></span></button>
At the event onclick
of this button
, he returns me a url
complete, but when I use this code through jQuery using a .append()
as follows:
$j('#mini-cart').append("<button type='button' title='<?php echo Mage::helper('core')->quoteEscape($this->__('View all items in your shopping cart')) ?>' class='button btn-inline-ver-carrinho' onclick='setLocation('<?php echo $this->getUrl("checkout/cart") ?>')'><span><span>Ver Carrinho</span></span></button>");
The same code returns to me on onclick
to url
, but without the bars(/) and running this code normally without being through jQuery, the url
is shown correctly.
Through the php
, he returns me the following: onclick="setLocation("localhost/checkout/cart")"
Through the jQuery
, he returns me the following:
onclick="setLocation("localhost checkout cart')'
assigning
<?php echo $this->getUrl("checkout/cart") ?>
to a variable, try to see if the value is correct. show the value in your question, I also do not know the setLocation function it is native? if you don’t post her code too so we can simulate.– Caique Romero
@Caiqueromero Doing this and giving one
console.log()
in this variable, the value comes correctly.– Matheus Portela
Edit your question and provide the value that comes and the setLocation() function, so we can test and try to figure out the problem.
– Caique Romero
@Caiqueromero I edited the question, according to what you said.
– Matheus Portela