You can write the verification code yourself, or you can use a third-party library. There are many third-party libraries now. For the refresh mechanism, it is recommended to use the API method. Just write a Javascript to give a random number to distinguish. Example: Here I am using the third-party verification code library gregwar/captcha
1. Refresh in the else part of the callback. The method is given above.
2. If you have done the first point and it has not been refreshed, then I guess there is something wrong with your judgment: if(data.info==1) Here, should it be: if(data.status== 1) ????
3.$("#2")What is it? The ID cannot start with a number.
You can write the verification code yourself, or you can use a third-party library. There are many third-party libraries now. For the refresh mechanism, it is recommended to use the API method. Just write a Javascript to give a random number to distinguish.
Example:
Here I am using the third-party verification code library gregwar/captcha
If you mistakenly refresh automatically, call the re_captcha method again.
The principle of refreshing the verification code is actually very simple, just add a suffix?t=123123
1. Refresh in the else part of the callback. The method is given above.
2. If you have done the first point and it has not been refreshed, then I guess there is something wrong with your judgment:
if(data.info==1)
Here, should it be: if(data.status== 1) ????
3.$("#2")What is it? The ID cannot start with a number.
My personal habits are probably like this
Save a src on the verification code image and save the original address of the verification code (to prevent the image address from getting longer)
Bind click switching event
When the verification code is wrong, the verification code click event is released through trigger to switch the verification code
Add below