Refresh a tab of an ajax page

106
February 13, 2018, at 10:45 PM

I'm having a little problem with refreshing a tab and not a whole page in Ajax. This tab concerns the removal of credit cards. Once I select the credit card I want to delete and validate I use "window.location.reload ();" which allows refreshing the whole page but suddenly it sends me back to "My profile" (see photo):

Before refresh:

After refresh:

While I want it refreshes only tab "means of payment" here is my code:

handleCardDelete = () => {
    var numCard = $('input[name=rbCard]:checked').val();
    console.log(this.state.token);
     $.ajax({
        url: 'http://API.....,
        dataType: 'json',
        type: 'DELETE',
        headers: {
            'Authorization' : 'Bearer ' + this.state.token
        },
        complete: function(){
            alert("carte supprimée avec succès");
            window.location.reload();
        },
    });
};

HTML

<Button animated='fade' onClick={this.handleAddCardSubmit}>
            <Button.Content visible>
                Ajouter une carte
            </Button.Content>
            <Button.Content hidden>
                <Icon name='add' />
            </Button.Content>
        </Button>
        <Button animated='fade' onClick={this.handleCardDelete}>
            <Button.Content visible>
                Supprimer la carte
            </Button.Content>
            <Button.Content hidden>
                <Icon name='delete' />
            </Button.Content>
</Button>

I hope I have been clear, I continue my research and I wish you a good day!

READ ALSO
FullCalendar event color

FullCalendar event color

I currently use FullCalendar v3

135
How to refresh div in order to get newly incoming data from DB

How to refresh div in order to get newly incoming data from DB

I am using the jquery news ticker from (http://jquerynewstickercom/) as my footer

107
Measure keyboard height in iOS using javascript

Measure keyboard height in iOS using javascript

Is there a way to calculate the height of the keyboard in iOS using javascript/jquery? Or, what I'm really after, the actual viewport height?

154
Filtering Array of objects with array of strings to get result with &#39;&amp;&amp;&#39; clause

Filtering Array of objects with array of strings to get result with '&&' clause

I have a data related to locations which comes from a different api and which needs to be used to filter another set of data based of locations selection

108