tailieunhanh - Wordpress 3.0 jQuery - part 27
Tham khảo tài liệu 'wordpress jquery - part 27', công nghệ thông tin, đồ họa - thiết kế - flash phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | AJAX with jQuery and WordPress That s the gist. We re now ready to get down to work by setting up the success and error functions. Let s start with the success function. We ll first want to create a div that will contain a message. We ll then add our message to that div along with the comment variable that we set up earlier under our formData serialized object to pull the comment entered in the form into our code. We ll also be sure to add in a little jQuery shine and leverage some of those animation skills from Chapter 5 jQuery Animation within WordPress to make sure the success response loads in nice and smooth. Inside the success function brace brackets insert the following code . on success load content and fade in create the div that the message goes in jQuery respond .prepend div class message div jQuery respond .message .html div style border 1px solid ccc padding 5px 10px b Thank you. b br span style font-size 90 i Your comment may be pending moderation. i span br comment div .hide then hide it .fadeIn 2000 then fade it in nicely When the Form is properly filled out the end result is this message that fades in 246 Chapter 7 We re now ready to tackle the people who don t fill the form out properly. The file does throw an error back if the required fields are not filled out. We can use this to our advantage by just checking for an error using the error function. Sorry Please fill out all the required fields Leave a Reply Your email address will not be published. Required fields are marked Nice we just created some slick commenting functionality for our WordPress site using AjAx 247 AJAX with jQuery and WordPress Shouldn t some of these examples be WordPress plugins As mentioned in Chapter 3 Digging Deeper Understanding jQuery and WordPress Together if you create a jQuery enhancement that doesn t require any tweaks or edits to the WordPress theme and will work with most themes released for public use you may want to consider wrapping up .
đang nạp các trang xem trước