# need help with delete

**URL:** <https://forum.wixstudio.com/t/need-help-with-delete/17242>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [July 18, 2019, 2:05pm UTC](https://forum.wixstudio.com/t/need-help-with-delete/17242 "2019-07-18T14:05:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xsw027](https://avatars.discourse-cdn.com/v4/letter/x/ed8c4c/32.png) [@xsw027](https://forum.wixstudio.com/u/xsw027)\
**Post date:** [July 18, 2019, 2:05pm UTC](https://forum.wixstudio.com/t/need-help-with-delete/17242/1 "2019-07-18T14:05:36Z")

</div>

New to wix. Need help with deleting the data on dynamic page. I have a page showing user data from database collection (dynamic item page). I want to allow user to delete the data and get redirected to homepage. The delete button does not have the ‘when successful, navigate to x page’ function. When I used the link for the button, it does not seem to work when staying on the same page. Please help. Thanks!

 ![](https://us1.discourse-cdn.com/wix/original/3X/2/7/277b9005a27d7b29c7847fef6781f9d8c8d9a552.png)

---

<div class="post-metadata">

**Author:** ![hamza](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/hamza/32/5176_2.png) [@hamza](https://forum.wixstudio.com/u/hamza)\
**Post date:** [July 18, 2019, 2:20pm UTC](https://forum.wixstudio.com/t/need-help-with-delete/17242/2 "2019-07-18T14:20:57Z")

</div>

You can use wixLocation to allow the button to navigate to whatever page you want. Telling it to navigate to “/” will redirect it to your homepage.

```javascript
import wixLocation from 'wix-location';

export function button3_click(event) {
wixLocation.to("/")
}

```

---

<div class="post-metadata">

**Author:** ![xsw027](https://avatars.discourse-cdn.com/v4/letter/x/ed8c4c/32.png) [@xsw027](https://forum.wixstudio.com/u/xsw027)\
**Post date:** [July 18, 2019, 2:51pm UTC](https://forum.wixstudio.com/t/need-help-with-delete/17242/3 "2019-07-18T14:51:56Z")

</div>

the delete works but the redirection still does not work.

**import** wixLocation **from** ‘wix-location’;

$w.onReady( **function** () {  
//TODO: write your page related code here…

});

export function button3\_click(event) {  
//Add your code for this event here:  
wixLocation.to(“/home”)  
}

---

<div class="post-metadata">

**Author:** ![hamza](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/hamza/32/5176_2.png) [@hamza](https://forum.wixstudio.com/u/hamza)\
**Post date:** [July 18, 2019, 2:57pm UTC](https://forum.wixstudio.com/t/need-help-with-delete/17242/4 "2019-07-18T14:57:07Z")

</div>

Check the button properties and make sure you have an event handler “onClick”

(Mine says button2, but of course yours will be button3)

![](https://us1.discourse-cdn.com/wix/original/3X/f/2/f284188e06a96c4aa37fbf9d26135035c9d0623d.png)

---

<div class="post-metadata">

**Author:** ![xsw027](https://avatars.discourse-cdn.com/v4/letter/x/ed8c4c/32.png) [@xsw027](https://forum.wixstudio.com/u/xsw027)\
**Post date:** [July 18, 2019, 3:04pm UTC](https://forum.wixstudio.com/t/need-help-with-delete/17242/5 "2019-07-18T15:04:40Z")

</div>

Worked! Thank you so much for your help!
