SoFunction
Updated on 2025-04-09

The reason why the function is called twice when getJSON calls background json data

The reason why the function is called twice when getJSON calls background json data

Updated: September 29, 2013 16:08:32 Submission: whsnow
Recently, when I was doing front-end development, I used getJSON to call the background json data. I found that the background function was called twice, and the function name is getMessages. Below are some of my guesses. Interested friends can refer to it.

Recently, when I was doing front-end development, I used getJSON to call the background to json data. I found that the background function was called twice, and the function name was getMessages.

Multiple investigations combined with online brother experience found that as long as the function name does not start with get, there is no problem.

It is bold to guess that when constructing json data when requesting returns, call all functions starting with get, then get the return value and then construct the response.

Therefore, when a function starting with a function that acts as an action, it is first called once in response to the request, and then the constructed response is called again.

  • jquery call action
  • Function calls twice

Related Articles

  • Use backend code registration scripts in the process of generating interface misalignment of JQUERY-EASYUI

    The previous article solved the problem of repeated execution of backend registration scripts when using JQUERY-EASYUI. Today, I found that the interface generated through back-end code is misaligned.
    2010-06-06
  • jquery implements a small countdown application

    This article mainly introduces the small application of jquery to implement countdown, which has certain reference value. Interested friends can refer to it.
    2017-09-09
  • jquery simply implements tab menu code with progressive display effect

    This article mainly introduces jquery to simply implement tab menu code with gradual display effect, which can realize the gradual display effect during tab tab switching, which has certain reference value. Friends who need it can refer to it
    2015-09-09
  • jQuery implements the instance code of the pull-down loading function

    This article introduces the jquery to implement the drop-down loading function through a piece of example code. The code is simple and easy to understand. If you need it, please refer to it.
    2016-04-04
  • Detailed explanation of the precautions for using on method in jQuery

    This article mainly introduces precautions for using on method in jQuery. It has good reference value, let's take a look with the editor below
    2017-02-02
  • No Flash Copy text to clipboard using jQuery

    All you need to do is introduce its script, assign a "data-clipboard-target" attribute to the HTML tag and write a small JavaScript snippet. To demonstrate that there is a currency conversion application, the redemption result is displayed in another text box when entering a value in one text box. When the text box is clicked, an event is triggered to copy it to the clipboard and then a message is displayed.
    2016-04-04
  • How to judge the pop-up message when the browser is back

    This section mainly introduces the message popup when jquery judges the browser backwards. Friends who need it can refer to it.
    2014-08-08
  • jquery to implement carriage return login details and example code

    This article mainly introduces the detailed explanation of jquery login. It has compiled several methods and simple implementation examples. Friends who need it can refer to it.
    2016-10-10
  • Basic usage tutorial for selectors in jQuery

    The selector of jQuery is very powerful, allowing you to easily select any object on the page. Let’s take a look at the basic tutorial on using selectors in jQuery for DOM operations. Friends who need it can refer to it.
    2016-05-05
  • jQuery copy form elements with source code sharing effect demonstration

    When we encounter submitting a form, we need to add several forms repeatedly and add multiple product information of different models to the order form. At this time, there is a copy form button, which means adding a new item. By clicking the copy button, it can be added. How can it be implemented? The editor will share with you below. Friends who need it can refer to it.
    2015-09-09

Latest Comments