defunkt / jquery-pjax

pushState + ajax = pjax
https://pjax.herokuapp.com
MIT License
16.74k stars 1.97k forks source link

Pjax: custom object with form data #690

Closed vikramktechhighway closed 6 years ago

vikramktechhighway commented 6 years ago

I want to post a form along with my custom object.

var myData = JSON.stringify(values); console.log(myData); $.pjax({ type: 'POST', url: url, container:'#' + pjax_id, data: myData, dataType: 'application/json' }); custom data is not posted along with formdata.

RichardTMiles commented 6 years ago

concider using the pjax.submit method and adding your data to a field in the forum

 $(document).on('submit', 'form[data-pjax]', (event) => {
        $(selector).hide();
        $.pjax.submit(event, selector)
    });
vikramktechhighway commented 6 years ago

@RichardTMiles Thank you