Submit form without page reloading

后端 未结 17 2464
无人及你
无人及你 2020-11-22 00:45

I have a classifieds website, and on the page where ads are showed, I am creating a \"Send a tip to a friend\" form...

So anybody who wants can send a tip of the ad

17条回答
  •  礼貌的吻别
    2020-11-22 01:21

    This should solve your problem.
    In this code after submit button click we call jquery ajax and we pass url to post
    type POST/GET
    data: data information you can select input fields or any other.
    sucess: callback if everything is ok from server
    function parameter text, html or json, response from server
    in sucess you can write write warnings if data you got is in some kind of state and so on. or execute your code what to do next.

    Tip somebody:

提交回复
热议问题