Why does sammy.js never use a mail route?

OK, so I just started using sammy.js, it’s not very good for me, but I was able to quickly learn the basics. HTML form that I use

<form id="contact_form" action="#/form" method="post">
<label for="name">Name:</label><input  class="textbox" type="text" name="name" id="name" />
<label for="email">E-mail:</label><input  class="textbox" type="text" name="email" id="email" />
<label for="message">Message:</label><textarea class="textbox" name="message"  id="message"></textarea>
<button type="submit" name="submit" value="Submit" id="submit" />
<p id="message_outcome"></p>

js I use to route my urls

var app = $.sammy(function(){
    this.element_selector = '#page1';
    this.get('#/about',function(context){
        $("ul#nav li").removeClass("active"); //removes "active" class
        $('#nav_1').addClass("active"); //adds "active" class to the tab that is selected
        $.post('home/about','', function(resp){
            $('#page1').html(resp);
            $('#page_container').cycle(0); //the number of the div that will be shown on click
        });
    });

    this.post('#/form', function(context){
       this.log('Form Submission');

    });
});


$(function(){
    app.run('#/about');
});

When the url has a # / form in it, I get a console log that says its running get route ('# / form') .. any ideas?

Here is some more information that may help.

JQuery Plugin I use aside from sammy

http://jquery.malsup.com/cycle/

, , "" .  [Sun Oct 10 2010 05:29:27 GMT-0400 ( )] runRoute #/form/public/js/lib/sammy.js:96 [Sun Oct 10 2010 05:29:27 GMT-0400 (Eastern Daylight Time)] 404 get #/form : 404 Not Found #/form

+3
3

, , - , sammy. , jQuery.

var app = $.sammy('#content', function() {
   ...
});

Sammy , (#content ) click, submit, . , , , .

, (, , #content), sammy , .

+4

, HTTP GET '#/form', URL- . POST , . . Get .

+1

, Sammy.js, JavaScript app, - GET URL-. , , , script /. , POST .

0

Source: https://habr.com/ru/post/1768823/


All Articles