MsgBox - Jquery pass info to PHP and back, help, how to

Discussion in 'jQuery' started by cameleon, May 18, 2011.

  1. #1
    As you can see i am noob at jquery / javascript, i need to pass variable to GET or POST written in form (jquery) and the result from php need to be passed back to jquery, I started to write smthing as below, but it doesnt work.

    anyone help me out please

    // id and settings for msg box
    
    $("#registerin").click(function() {
      $.msgbox("<p>In order to process your request you must provide the following:</p>", {
        type    : "prompt",
        inputs  : [
          {type: "text",label: "Insert your Name:", value: "George", required: true},
        ],
        buttons : [
          {type: "submit", value: "OK"},
          {type: "cancel", value: "Exit"}
        ]
      }, // id and settings for msg box - end
       function(name) {
        // checking if name field has been set
        if(name) {
        // pass from field to php $_GET['name_php'] variable
          $.get("form.php", {name_php: name },
        function(data) {
        if (data){
            // inline the data creation/insertion
            $.msgbox($('#textbox').html(data), {type: "info"});
        } // if data end
      }); // function data end
    
        } // if name end
      }); // function name end
    
    }); // registerin click
    Code (markup):
    Its already fixed
     
    Last edited: May 18, 2011
    cameleon, May 18, 2011 IP