Home > front end >  Ajax in the repeat, not repeat submitted
Ajax in the repeat, not repeat submitted

Time:09-17

The code is as follows, only the ajax carried out two times, why?

The function upWord (ln) {
The readme (1);//was performed 1
$. Ajax ({
Type: "post",
DataType: "json",
Url: "upWords? Math="+ math. The random (),
Data: {
"LN" : LN
},
BeforeSend: function (data) {
The readme (2);//was carried out 2 times
},
});
}

CodePudding user response:

Is it not written request performed twice before?

CodePudding user response:

BeforeSend when once again Send

CodePudding user response:

BeforeSend is ajax requests before the execution of the function, you perform upWord () function is executed after the readme (1), ajax, executed and then perform an ajax request again because beforeSend execute the readme before (2)

CodePudding user response:

BeforeSend: function (data) {
In this line of interrupt point
https://segmentfault.com/a/1190000022017137

CodePudding user response:

reference wbxucw reply: 3/f
beforeSend is ajax requests before the execution of the function that you perform upWord () function is executed after the readme (1), ajax, executed and then perform an ajax request again because beforeSend execute the readme before (2)


The building Lord ask is why the readme (2) was carried out 2 times, the building Lord asked why not the readme was carried out twice, pay attention to the building to write comments,
In addition the building in question is clear that the [only performed twice in the ajax, why?] While the readme (1) is outside of ajax, the original poster is ajax the readme (2)

CodePudding user response:

refer to fifth floor however reply:
Quote: refer to the third floor wbxucw response:
beforeSend is ajax requests before the execution of the function that you perform upWord () function is executed after the readme (1), ajax, executed and then perform an ajax request again because the beforeSend perform the readme before (2)


The building Lord ask is why the readme (2) was carried out 2 times, the building Lord asked why not the readme was carried out twice, pay attention to the building to write comments,
In addition the building in question is clear that the [only performed twice in the ajax, why?] While the readme (1) is outside of ajax, the original poster is ajax the readme (2)


Analysis of, ha ha
  •  Tags:  
  • Ajax
  • Related