Sign in to follow this  
SwekAap

[help] Sending data from <a> tag to server?

Recommended Posts

Hello, i'm trying to get the character id from an <a> tag and send it to the server so when i click the button it will send that id to the server. Currently i got this in the login.html

<b v-for="character in characters">
    <a class="link-button link-button_margin1 link-button_theme-orange transition-02 hover" v-bind:char_id="character.id" @click="login" v-if="characters">{{ character.name }}</a>
</b>

And the "login" function to send it to the server is here

login: function () {
    mp.trigger("cMisc-CallServerEvent", "sLogin-TryLoginWithoutCode", this.char_id);
}

This.char_id does not work however and will result into my server crashing. I want to send the "character.id" to the server.

 

Thanks in advance.

Share this post


Link to post
Share on other sites

I've fixed it myself.. 

Solution:

<b v-for="character in characters">
    <a class="link-button link-button_margin1 link-button_theme-orange transition-02 hover" @click="login(character.id)" v-if="characters">{{ character.name }}</a>
</b>
login: function (char_select) {
    mp.trigger("cMisc-CallServerEvent", "sLogin-TryLoginWithoutCode", char_select);
}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.