On Sun, May 11, 2008 at 10:17 PM, Jason Huck <jason.h
...@gmail.com> wrote:
> You're pretty close, but you don't need *both* $.post() and .load().
> Just pick one or the other. Using .load() is a little bit simpler, but
> I believe it uses GET behind the scenes:
> <script type="text/javascript">
> $(function(){
> $('#yourbutton').click(function(){
> $('#submit_result').load('test.php', { input: $('input').val() });
> });
> });
> </script>
> ...so if it's important that it be submitted via POST, then something
> like this should work:
> <script type="text/javascript">
> $(function(){
> $('#yourbutton').click(function(){
> $.post('test.php', { input: $('input').val() }, function(data){
> $('#submit_result').html(data);
> });
> });
> });
> </script>
> HTH,
> Jason
> On May 11, 3:41 pm, "Jón Helgi Jónsson" <amyth...@gmail.com> wrote:
>> Hi,
>> I'm new to Jquery.
>> I'm trying to send the post data from an input box to test.php however
>> it doesn't go over when test.php loads into #submit_result.
>> This is what I have so far. What am I doing wrong? I know I am doing
>> something dumb.
>> <script type="text/javascript">
>> function my_onclick() {
>> $.post("test.php",
>> {input: $("input").val()},
>> function(data) {
>> $("#submit_result").load("test.php");
>> });
>> }
>> </script>
>> Thanks,
>> Jon