0

I'm posting from a form to a URL like so:

$.post('?class=articles&method=submit', $(this).serialize(), function(msg)
{
    alert(msg);
    $(msg.html).hide().insertBefore('#addCommentContainer').slideDown();
    $('#body').val('');
},'json');

And in the 'submit' method the last line is:

print json_encode( array('html'=>$content) );

Yet I'm not even getting to the alert portion in the jQuery.

I have a feeling it is because the 'submit' method is in a class file that is part of a template system (similar to phpBB). I know that creating a seperate .php file for submitting would work, but was curious if there was any other way.

1
  • what does the php file you are posting to look like? Commented Aug 2, 2010 at 21:28

2 Answers 2

1

Looks like you don't even have a specific url:

$.post('?class=articles&method=submit', $(this).serialize(), function(msg)

Should be I think

$.post('thePlaceIsubmitTo.php?class=articles&method=submit', $(this).serialize(), function(msg)

I believe that the serialize data will be appended to the url with and &, Be sure that this refers to the form tag

Sign up to request clarification or add additional context in comments.

Comments

0

try using the $.ajax method, instead of the shorthand. I believe the problem is that you're using the POST shortcut method, while specifying GET variables appended to the URL.

Let me know if this helps, if not, We'll be able to help you :-)

I'm on vacation, on a netbook, so I can't exactly write a whole new method at the moment.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.