CLARIFYING:

I have two different URL's between my form's action and my url set in
the options that are sent to $('#myForm').ajaxForm(options)

I did that just because in earlier testing I was trying to confirm
that the URL used in my options variable would actually override the
value that was set in the action of the form

THANKS so much to the group for all past and future help!


On Feb 26, 10:42 am, Brian Long <brilon...@gmail.com> wrote:
> James, (and all)
>
> Thanks a lot for the help - I'm now seeing all of  the things I want
> in firebug.  I'm getting an XHR respose (is this the proper
> terminology?  Is XHR always a request? regardless...)
>
> I'm getting a response from my script which includes a <script> tag
> (with functions) and an HTML form.  I now want to do something like
> this (see the code below).
>
> The main issue is this with the jquery form plugin, you can set a URL
> to send the data to (via post, etc.) but the script never runs.  Can
> you tell me how to process the response so that it will?  I do get the
> HTML appended where I want it, but the script will not run.  Not even
> my alert.
>
> I've also tried using "onsubmit" of the form call my function, but
> that doesn't seem to work either.  Do you know if that would work
> normally?
>
> Googling process XHR response or eval XHR response or eval(window);
> all seem incorrect. I'm very bad at javascript and much more
> comfortable with php -----  PLEASE help if you can :-/
>
> // This is essentially what's in my script
>
> $('response_node').ready(function(){
>         alert('i ran');
>         var options = {
>                 target:        '#myForm',   // target element(s) to be 
> updated with
> server response
>                 beforeSubmit:  showRequest,  // pre-submit callback
>                 success:       showResponse,  // post-submit callback
>                 // other available options:
>                 url:       'voting.php',        // override for form's 
> 'action'
> attribute
>
>         };
>         // If binding works, prevent default submit event
>         if( $('#myForm').ajaxForm(options)){
>                 $('#myForm').submit(function(e){
>                         e.preventDefault();
>                 });
>
>         };
>
>         function showRequest(formData, jqForm, options) {
>                 var queryString = $.param(formData);
>                 console.log('inside showRequest of questionHandler using' +
> queryString);
>                 $('#output1').html('<h6>showRequest Called</h6>');
>                 return false;
>         }
>
>         // post-submit callback
>         function showResponse(responseText, statusText)  {
>                 console.log('inside showResponse using'' + statusText +
> 'responseText:' + responseText);
>
>                 $('#poll_div').html('<h6>showResponse Called</h6>')
>                 $('#poll_div').append(responseText);
>         }
>
> });
>
> // and my form is basically
>
> <form id='myForm' action='dont_run.php' method='post' class='vote' >
> // stuff
> </form>
>
> On Feb 25, 9:43 pm, James <james.gp....@gmail.com> wrote:
>
> > Yes, that's normal.
>
> > On Feb 25, 1:55 pm, Brian Long <brilon...@gmail.com> wrote:
>
> > > Hey everybody - I'm definitely an amateur, but I have a pretty good
> > > understanding of PHP / MySQL / Firebug / FirePHP so I think we can
> > > work through this.
>
> > > If using the standard form plugin model - I have the callback:
>
> > > function showResponse(responseText, statusText)  {
>
> > >     $('#myForm').html('<h1>Submission was successful</h1>' +
> > > responseText);
>
> > > }
>
> > > I do see the HTML change in the browser / firebug for this element:
> > > <form id=myForm>
>
> > > but when I view source (in Firefox) ---> I see the HTML that would of
> > > existed before the AJAX submission.
>
> > > Is this normal?
>
> > > Thanks in advance
> > > Brian Long
>
>

Reply via email to