开发者

How to convert an AJAX error code generated at runtime into a php variable for analysis

开发者 https://www.devze.com 2023-04-05 03:50 出处:网络
I am using an ajax function in my c开发者_如何学运维ode. If an error occurs a div shows the error number. I need this error value for a further database query on same page. How can this be done? You n

I am using an ajax function in my c开发者_如何学运维ode. If an error occurs a div shows the error number. I need this error value for a further database query on same page. How can this be done?


You need to send the value to the PHP file you're using to process those values.

To do this asynchronously, use $.ajax() or one of it's simpler $.post() or $.get() siblings.

So, your workflow will be

  1. Capture the error number in javascript variable.
  2. Make an AJAX request, sending this variable in the data.
  3. Process the request in your PHP file.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号