Giter Club home page Giter Club logo

Comments (3)

m-2k avatar m-2k commented on May 16, 2024

Redirection does not work in the function main/0, because wf:redirect uses wf:wire transmission for Actions in the browser. Thus because the page does not load; and does not load javascripts that are present In standard template and are responsible for the communication server and the client. Action #wire simply can not be executed in the browser because of lack of connection is initialized through n2o_bullet.

I suggest using the following scheme:

  • Create template empty.html
<html>
<head>
  <script>{{script}}</script>
  <script src='/static/nitrogen/bullet.js' type='text/javascript' charset='utf-8'></script>
  <script src='/static/nitrogen/n2o.js' type='text/javascript' charset='utf-8'></script>
</head>
</html>
  • And redirect as follows:
main() -> wf:redirect("/login"), #dtl{file = "empty"}.

It will be correct to redirect in the main/0 function.

Now the browser will receive HTML with links to the scripts (<script>...</script> in <head> section), download the javascripts. Loading scripts will create a connection through which will be transferred action #wire (window.location = '/login'). Thereafter immediately be redirected.

Enjoy.

from n2o.

radetsky avatar radetsky commented on May 16, 2024

Thank you. It's works now. Before n2o.js and bullet.js developer need to add jQuery.js.

from n2o.

m-2k avatar m-2k commented on May 16, 2024

N2O version 1.4+ does not require jQuery and uses only native javascript.

from n2o.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.