Errr sure. In your server side code just return the div rather than a
whole page. You could add  an argument such as "ajax=true"  to the
form post URL.

If you really don't want to change your server side code you could
strip the "page wrapping" from the whole page you get back. (Untested
code follows)

  var div = data.replace( /([\s\S]+)<body([^>]*)>/, '' ).replace(
/<\/body>([\s\S]+)/, '' );

Karl Rudd

On Fri, May 16, 2008 at 7:24 AM, hubbs <[EMAIL PROTECTED]> wrote:
>
> For some reason, the script is returning an entire page for the data
> part, am I able to just return a div?
>
> On May 14, 5:28 pm, "Karl Rudd" <[EMAIL PROTECTED]> wrote:
>> If you know your response is always going to be HTML then you could
>> use something like this:
>>
>> $('#uploadForm').ajaxForm({
>>         success: function(data) {
>>                 $('#uploadOutput').append( data );
>>         }
>>
>> });
>>
>> The "data" argument in the success function is what holds the response.
>>
>> Karl Rudd
>>
>> On Thu, May 15, 2008 at 10:11 AM, hubbs <[EMAIL PROTECTED]> wrote:
>>
>> > Ok, I am confused.  Here is the jQuery script from the Form Plugin:
>>
>> >    $('#uploadForm').ajaxForm({
>> >        beforeSubmit: function(a,f,o) {
>> >            o.dataType = $('#uploadResponseType')[0].value;
>> >            $('#uploadOutput').html('Submitting...');
>> >        },
>> >        success: function(data) {
>> >            var $out = $('#uploadOutput');
>> >            $out.html('Form success handler received: <strong>' +
>> > typeof data + '</strong>');
>> >            if (typeof data == 'object' && data.nodeType)
>> >                data = elementToString(data.documentElement, true);
>> >            else if (typeof data == 'object')
>> >                data = objToString(data);
>> >            $out.append('<div><pre>'+ data +'</pre></div>');
>> >        }
>> >    });
>>
>> > It seems like alot of it is not needed for me.  All I want to do is
>> > return the HTML response.  Also, is there a way to grab additional
>> > HTML out of the iframe after submit?
>>
>> > On May 12, 9:49 pm, "Karl Rudd" <[EMAIL PROTECTED]> wrote:
>> >> Yeah the iframe is the way to go, that's the way the plugin does it.
>>
>> >> Karl Rudd
>>
>> >> On Tue, May 13, 2008 at 2:23 PM, hubbs <[EMAIL PROTECTED]> wrote:
>>
>> >> >  I see.
>>
>> >> >  Is there a way that I can still use ajaxpost, but submit that to an
>> >> >  iframe?  Or is the only way to do it is by using a normal form?
>>
>> >> >  On May 12, 8:44 pm, "Karl Rudd" <[EMAIL PROTECTED]> wrote:
>> >> >  > You can't actually do file upload via AJAX, it's a security 
>> >> > "feature",
>> >> >  > it can be "faked" though.
>>
>> >> >  > Try this plugin:
>> >> >  >  http://plugins.jquery.com/project/form
>>
>> >> >  > Karl Rudd
>>
>> >> > > On Tue, May 13, 2008 at 1:38 PM, hubbs <[EMAIL PROTECTED]> wrote:
>>
>> >> >  > >  I have set up a form that uses the $.ajax function usingPOST.  
>> >> > Part
>> >> >  > >  of my form is animageupload dialog, using the standard file upload
>> >> >  > >  input box.  The problem is, the upload is not working, and I 
>> >> > think it
>> >> >  > >  has to do with the encoding.  When I upload it with ajax, it just
>> >> >  > >  sendsthroughthe path to the file on my local computer.  But if I 
>> >> > use
>> >> >  > >  normal formPOST, without ajax, it will send theimagecontents
>> >> >  > >  through(I can see all the data that was sent, with ajax it is not
>> >> >  > >  there.)  So, what I need to know is, for something like this, so I
>> >> >  > >  need to be encoding that somehow?
>

Reply via email to