We will create a post()
method inside the status.js
library, and bind the method with the click event on the Submit button. We will create the method by adding code lines one after another, as shown in the following steps:
1. At our
status.js
library, type the followingpost()
method, terminated with a comma, to add it inside theStatus
library:post: function () { var myname = 'M A Hossain Tonu', myimage = 'images/user/tonu.jpg'; var loadingHtml = '<img src="images/ajaxload.gif" alt="loadin.." border="0" >'; var successMsg = 'Status Posted Successfully ...'; var statusTxt = $('#status_box').val(), postStatus = $('#postStatus'); },
At the variable declaration section, the
myname
andmyimage
variables contain a demo logged-in, user's name and profile picture URL. TheloadingHtml
contains the img tag for displaying the loading GIF animation. Also, you can see thatstatusTxt
contains the status box value obtained using$('#status_box...