1

I'm trying to get some info from entry like entry ID that the Guest plugin sent it via Ajax. There are the keys that the plugin responds back with. How can I work out to those keys respectively call them? (response.id) for example?

  • Are you asking how to retrieve the data returned from the AJAX call? – Stephen Lewis Apr 15 '17 at 18:36
  • Yes @StephenLewis – Dominik Krulak Apr 15 '17 at 18:41
2

According to the README, the Guest Entries plugin accepts an AJAX request, and returns an object containing the entry ID, title, and so forth.

As such, if you're using jQuery, you should be able to do something like this (not tested):

$.ajax({
    data: $('#theform').serialize(),
    method: 'POST',
    done: function (data) {
        // The entry title.
        console.log(data.title);
    }
});

I'm not sure how Guest Entries handles errors, so you'll probably want to check the data.success property, before proceeding.

| improve this answer | |
  • I've ended up calling for entry's data with jQuery response function and so on as you've indicated for checking errors. That worked well! – Dominik Krulak Apr 16 '17 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.