How can I show web page after save/apply

Hi, everyone.
I`m trying to make an WebUI for router.
And I have a problem.

  1. I`ll change some configuration in xxx/wan, after save/apply I wan to show xxx/wan.
    But, my web show other like below.

In html file, I call setApcli() like below.
<form name="STA mode" id="STA mode" class="off" action="<%=luci.dispatcher.build_url("api", "XXX","setApcli")%>" method="post" onSubmit="return doCheck2();">

and this is my setApcli function
function setApcli()
local result = {}
local LuciHttp = require("luci.http")
local XXXWan =require("luci.model.XXXapi.XXXLanWanFun")

    local apcli_mode = LuciHttp.formvalue("apcli_mode")
    local ifname = LuciHttp.formvalue("ifname")
    local dhcpdis = LuciHttp.formvalue("dhcpdis")
    local apcli_ssid = LuciHttp.formvalue("apcli_ssid")
    local apcli_enc = LuciHttp.formvalue("apcli_enc")
    local apcli_auth = LuciHttp.formvalue("apcli_auth")
    local apcli_pw = LuciHttp.formvalue("apcli_pw")
    JCGWan.set_apcli(dhcpdis, apcli_ssid, apcli_auth, apcli_enc, apcli_pw, ifname, apcli_mode)
    os.execute("/usr/bin/stamode")
    luci.http.prepare_content("application/json")
    luci.http.write_json(result)

end

Actually, I don`t know well about "luci.http.write_json"..
so I tried each command instead of luci.http.write_json like below. but the result is same.. show xxx/setApcli
luci.http.redirect(luci.dispatcher.build_url("xxx","wan"))
luci.template.render("xxx/wan")

please help.
Thank you.