# Session-Variable per Ajax-Anfrage setzen

**URL:** <https://forum.shopware.com/t/session-variable-per-ajax-anfrage-setzen/18425>\
**Category:** Shopware 3.5\
**Tags:** programming\
**Created:** [13. Februar 2014 um 13:33 UTC](https://forum.shopware.com/t/session-variable-per-ajax-anfrage-setzen/18425 "2014-02-13T13:33:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![radox1](https://avatars.discourse-cdn.com/v4/letter/r/e19b73/32.png) [@radox1](https://forum.shopware.com/u/radox1)\
**Post date:** [13. Februar 2014 um 13:33 UTC](https://forum.shopware.com/t/session-variable-per-ajax-anfrage-setzen/18425/1 "2014-02-13T13:33:11Z")

</div>

Hallo Community, hab ein kleines Problem, bei dem ich momentan nicht weiterkomme. Ich möchte per Ajax den Wert von Session-Variablen setzen - siehe Beispiel. Die Post-Parameter werden korrekt übergeben. Das Session-Cookie und die passende Session-ID werden mit der Ajax-Anfrage übermittelt. Die Sessionvariablen werden aber trotzdem nicht bzw. nur ab und zu mal gesetzt. Evtl. nur ne Kleinigkeit. Wäre super, wenn von Euch jemand eine Idee hat. Danke vorab! ` $.ajax({ type: "POST", url: $.getBaseUrl() + "OutfitDesigner/setScreenInfo", data: { type: screenType, width: canvasWidth }, cache: false }); public function setScreenInfoAction() { Shopware()-\>Plugins()-\>Controller()-\>ViewRenderer()-\>setNoRender(); Shopware()-\>Session()-\>outfitDesigner['screen\_type'] = intval($this-\>Request()-\>getPost('type')); Shopware()-\>Session()-\>outfitDesigner['canvas\_width'] = intval($this-\>Request()-\>getPost('width')); } `

---

<div class="post-metadata">

**Author:** ![radox1](https://avatars.discourse-cdn.com/v4/letter/r/e19b73/32.png) [@radox1](https://forum.shopware.com/u/radox1)\
**Post date:** [14. Februar 2014 um 00:45 UTC](https://forum.shopware.com/t/session-variable-per-ajax-anfrage-setzen/18425/2 "2014-02-14T00:45:22Z")

</div>

Wenn ich ‚async‘ auf ‚false‘ setze oder andere Ajax-Requests welche zur gleichen Zeit gestartet werden abschalte, dann funktionierts. Die Controller-Action wird aber in beiden Fällen aufgerufen!? ` $.ajax({ type: "POST", url: $.getBaseUrl() + "OutfitDesigner/setScreenInfo", data: { type: screenType, width: canvasWidth }, async: false, cache: false }); `
