jQuery Show/Hide Div as per the ajax response and pass the response's requestId to the success Div

前端 未结 2 1116
孤城傲影
孤城傲影 2021-01-25 10:47

I have the below code for show/hide success div as per the service call\'s response plus i need to pass the Service Response\'s request to the Success Div. How do i

2条回答
  •  天涯浪人
    2021-01-25 11:30

    When you are getting response msg you can use it as you want in your html. You can modify response message as you want, so use .html() in your javascript code to manipulate your response msg. Your response for example can be "Success, great, foo foo foo!" or "Error, foo foo foo!". Use ajax request as function to show response, generate response message in your req page.

    jsFiddle

    HTML:

    JS:

    $.ajax({
        url:
        type:
        data:
        success: function(msg){
            $("#showResponseArea span").html(msg); //you will paste your response msg to the span
        }
        error: funciton(msg){
            alert("Some Error Occured");
        }
    });
    

提交回复
热议问题