Nui callback working but closing ui

So I’ve been creating a lot of nui resources lately and an issue I’ve been running into is when I’m using a nui callback it will function right and go to the client file but the ui will be closed and I’m left with a mouse cursor on the screen.

Here is an example of the code:

js

$.post("https://Test_Script/Test", JSON.stringify({
            string: "this will be printed"
        }))

Client.lua


RegisterNUICallback("Test", function(data)
    print(data.string)
end)

This code above will function right and it will print the string on the client but only issue is that the html page will disappear and I will still be able to move the mouse all over the screen.

Any help appreciated, here is some scripts I’ve written that has this issue but I’ve set SetNuiFocus(false, false) in the client to fully close it after the callback. If you remove that you will run into that issue with these scripts below.

Atm and bank ui
Weapon Animation menu

Before/after you make the POST request, do you hide/change opacity of any HTML element? Also check developer tools console to check for any errors, as well as F8.

As you said SetNuiFocus(false, false) will make it so the NUI is not actively focused, thus why you’re able to move your mouse.

Thank you for your reply, there are no errors in the console and what I meant by setting the SetNuiFoucs(false, false) is if you look at the scripts I linked I did that if I didn’t do it then I would run into the issue that I described. I can show post a video later today.

Yes, you have to set Nui focus to false whenever you want to quit your (focused) Nui

This issue doesn’t exist.

1 Like

i think i found.
in js file u probably have links like that
image
and its very important to name of resource folder fully equal https://*/exit (if screen as example)

more than
as i guess client script should be in main direction (together with fxmanifest)