# set form action attribute without full url

**URL:** https://forum.shopware.com/t/set-form-action-attribute-without-full-url/37330
**Category:** Shopware 5
**Created:** [8. Juni 2016 um 18:07 UTC](https://forum.shopware.com/t/set-form-action-attribute-without-full-url/37330 "2016-06-08T18:07:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![alirizvi](https://avatars.discourse-cdn.com/v4/letter/a/96bed5/32.png) [@alirizvi](https://forum.shopware.com/u/alirizvi)
#### Post date: [8. Juni 2016 um 18:07 UTC](https://forum.shopware.com/t/set-form-action-attribute-without-full-url/37330/1 "2016-06-08T18:07:06Z")

</div>

This is what i am doing currently to set a form’s action through jQuery.

$(’#form’).attr(‚action‘,‚[http://testing.com/checkout/payment](http://testing.com/checkout/payment)‘);

&nbsp;

but is there a way to do it using controllers and actions like:

url controller=checkout&nbsp;action=payment

without writing whole orl in jQuery?

---

<div class="post-metadata">

### Author: ![wolkenkraft](https://avatars.discourse-cdn.com/v4/letter/w/65b543/32.png) [@wolkenkraft](https://forum.shopware.com/u/wolkenkraft)
#### Post date: [10. Juni 2016 um 06:32 UTC](https://forum.shopware.com/t/set-form-action-attribute-without-full-url/37330/2 "2016-06-10T06:32:49Z")

</div>

Hi,

It depends how the jQuery is created. If it´s a seperated file that´s simply included in the template, then you won´t be able to use smarty functions. If it´s an inline script then you can use the url smarty function.

Best,  
Michael

---

<div class="post-metadata">

### Author: ![wolkenkraft](https://avatars.discourse-cdn.com/v4/letter/w/65b543/32.png) [@wolkenkraft](https://forum.shopware.com/u/wolkenkraft)
#### Post date: [10. Juni 2016 um 06:35 UTC](https://forum.shopware.com/t/set-form-action-attribute-without-full-url/37330/3 "2016-06-10T06:35:38Z")

</div>

This will resolve your problems - passing the parameter via data attribute:

[http://forum.shopware.com/discussion/17770/smarty-variable-in-javascript](http://forum.shopware.com/discussion/17770/smarty-variable-in-javascript)

&nbsp;
