NYCPHP Meetup

[nycphp-talk] Wordpress & Ajax

Margaret Waldman mmwaldman at nyc.rr.com
Sat Jul 9 00:24:44 EDT 2011


You can do this with $.post

var jqxhr = $.post("example.php", function() {
      alert("success");
    })
    .success(function() { alert("second success"); })
    .error(function() { alert("error"); })
    .complete(function() { alert("complete"); });

I'll just through in an .error to $(div.formDiv).html("Access Failed. 
Please, contact us if you are seeing this message.");

Anyway, I better stop because this is a php forum.  Anyone know of a good 
javascript forum, I have a question about processing the xml in jquery 
returned from post.  I know how to process it with straight javascript.

-----Original Message----- 
From: Kristina Anderson
Sent: Friday, July 08, 2011 8:12 PM
To: talk at lists.nyphp.org
Subject: Re: [nycphp-talk] Wordpress & Ajax

$.post is easier to configure but has less flexibility.  If it has all
the functionality that you need for the specific instance you have, that
works!!

K

On 7/8/2011 7:31 PM, Margaret Waldman wrote:
> I was going to use $.ajax, but I thought $.post looked prettier.  What I'm 
> doing with this is very simple.  It's just return and success/failure code 
> via xml.
>
> -----Original Message----- From: Kristina Anderson
> Sent: Friday, July 08, 2011 5:16 PM
> To: talk at lists.nyphp.org
> Subject: Re: [nycphp-talk] Wordpress & Ajax
>
> Margaret,
>
> Your best bet for jQuery AJAX is to use the $.ajax function to route
> your asynchronous communications.  All you need to do is include the
> main jQuery file and then define your $.ajax function(s) wherever
> appropriate.  The function has inbuilt success & error methods which
> capture your returned stuff from PHP and allow you to pass it through
> into the DOM.
>
> See here for comprehensive documentation:
> http://api.jquery.com/jQuery.ajax/
>
> Kristina
>
> On 7/8/2011 1:41 PM, Margaret Waldman wrote:
>> This is what I found:
>> ./wp-includes/js/jquery/jquery.query.js
>> ./wp-includes/js/jquery/jquery.form.js
>> ./wp-includes/js/jquery/jquery.color.dev.js
>> ./wp-includes/js/jquery/jquery.table-hotkeys.js
>> ./wp-includes/js/jquery/jquery.serialize-object.js
>> ./wp-includes/js/jquery/jquery.hotkeys.dev.js
>> ./wp-includes/js/jquery/jquery.color.js
>> ./wp-includes/js/jquery/jquery.table-hotkeys.dev.js
>> ./wp-includes/js/jquery/jquery.form.dev.js
>> ./wp-includes/js/jquery/jquery.schedule.js
>> ./wp-includes/js/jquery/jquery.hotkeys.js
>> ./wp-includes/js/jquery/jquery.js
>> ./wp-includes/js/imgareaselect/jquery.imgareaselect.dev.js
>> ./wp-includes/js/imgareaselect/jquery.imgareaselect.js
>> ./wp-includes/js/jcrop/jquery.Jcrop.js
>> ./wp-includes/js/jcrop/jquery.Jcrop.dev.js
>>
>> A grep on ajax on the jquery.js file spewed out lotsa code.  Looks like 
>> I'll be good.
>>
>> -----Original Message----- From: Darryle Steplight
>> Sent: Friday, July 08, 2011 11:41 AM
>> To: NYPHP Talk
>> Subject: Re: [nycphp-talk] Wordpress & Ajax
>>
>> Hey Margaret,
>>       1. Just because a file uses jquery that doesn't mean it has
>> ajax functionality. You still have to make the ajax call on your own
>> if the showcase.js file isn't doing so.
>>       2. I'm not worried about  the details of your project. I was
>> going to help you and provide a solution on how I used my own jquery
>> ajax solution for my own wordpress project, but like you so
>> professionally said it "that's your problem".  Good luck.
>>
>> On Fri, Jul 8, 2011 at 11:35 AM, Margaret Waldman <mmwaldman at nyc.rr.com> 
>> wrote:
>>> Darryle,
>>>
>>> I see the file showcase.js in the themes/js directory uses jquery, which
>>> means jquery must be included, which means it should have ajax
>>> functionality.  And, don't worry about the details of my project. 
>>> That's my
>>> problem.  :-)
>>>
>>> Margaret
>>>
>>> -----Original Message----- From: Darryle Steplight
>>> Sent: Friday, July 08, 2011 11:20 AM
>>> To: NYPHP Talk
>>> Subject: Re: [nycphp-talk] Wordpress & Ajax
>>>
>>> Hi Margaret,
>>>    I'm sure there are some WP plugins out there that use ajax to
>>> work but it's not too difficult to create your own solutions. What
>>> types of ajax features do you want to create?
>>>
>>> On Fri, Jul 8, 2011 at 9:49 AM, Margaret Waldman <mmwaldman at nyc.rr.com>
>>> wrote:
>>>>
>>>> Does anyone know if Wordpress has any ajax features build in or do I 
>>>> have
>>>> to
>>>> add it?
>>>>
>>>> Margaret Michele Waldman
>>>> _______________________________________________
>>>> New York PHP Users Group Community Talk Mailing List
>>>> http://lists.nyphp.org/mailman/listinfo/talk
>>>>
>>>> http://www.nyphp.org/Show-Participation
>>>>
>>>
>>>
>>>
>>> -- 
>>> ----------------------------------------------
>>> "May the Source be with you."
>>> _______________________________________________
>>> New York PHP Users Group Community Talk Mailing List
>>> http://lists.nyphp.org/mailman/listinfo/talk
>>>
>>> http://www.nyphp.org/Show-Participation
>>> _______________________________________________
>>> New York PHP Users Group Community Talk Mailing List
>>> http://lists.nyphp.org/mailman/listinfo/talk
>>>
>>> http://www.nyphp.org/Show-Participation
>>>
>>
>>
>>
>
>
> _______________________________________________
> New York PHP Users Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> http://www.nyphp.org/Show-Participation
> _______________________________________________
> New York PHP Users Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> http://www.nyphp.org/Show-Participation
>


_______________________________________________
New York PHP Users Group Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

http://www.nyphp.org/Show-Participation 




More information about the talk mailing list