Question: I have a simple login form and it does return the "success" text in the function, but now I want to be able to add the text provided in the .php file. How can I do this?

html

```
 <script>
  $(function(){
      $("#submitlogin").click(function() {

        inputs = {
            "logInUsername" : $('input[name=logInUsername]').val(),
            "logInPassword" : $('input[name=logInPassword]').val()
        };
        // since this is a username and password combo you will probably want to use $.post
        $.ajax ({
            type: "POST",           
            url: "loggnow.php",
            data: inputs,
            success: function() {
                $("#login").html("You are now logged in!");
            },
            error : function(jqXHR, textStatus, errorThrown){
                alert("error " + textStatus + ": " + errorThrown);
            }
        });
      });
      });

```

Answer: 
```
    $.ajax({
        type: "POST",           
        url: "loggnow.php",
        data: inputs,
        dataType: "html",
        success: function (data) {
            $("#login").html(data);
        },
        error : function (jqXHR, textStatus, errorThrown) {
            alert("error " + textStatus + ": " + errorThrown);
        }
    });

```
The docs on jquery web sites says that the sucess function will be passed the data. (See quoted). So you can just use the content passed back in the "data" variable, and put it in there.

> 
> 
> ```
> success(data, textStatus, jqXHR)
> 
> A function to be called if the request succeeds. The function gets passed 
> three arguments: The data returned from the server, formatted according to 
> the dataType parameter; a string describing the status; and the jqXHR 
> (in jQuery 1.4.x, XMLHttpRequest) object. As of jQuery 1.5, the success 
> setting can accept an array of functions. Each function will be called in 
> turn.
> 
> ```
> 
>