ThemeShaper Forums » Thematic

[closed]

Submitting Fom From Custom Page

(3 posts)
  • Started 10 years ago by gezzeg
  • Latest reply from gezzeg
  • This topic is not resolved
  1. Hi,
    I have a problem here.

    I have create my child themes using thematic,

    i create my custom page and using fancy box to call a forms.

    I try to make the form to process without refresh using ajax.

    The problem is, i dont know where to put the "process.php" and how the url is. Is it in the child theme folder? and the url is /wp-content/themes/child-themes/process.php?

    <script type="text/javascript">
    $j=jQuery.noConflict();
    $j("#request_quotation").bind("submit", function() {

    $j.fancybox.showActivity();

    $j.ajax({
    type : "POST",
    cache : false,
    url : "/wp-content/themes/child-themes/process.php",
    data : $j(this).serializeArray(),
    success: function(data) {
    $.fancybox(data);
    }
    });

    return false;
    });
    </script>

    Thanks for your help. Really appreciates!

    Posted 10 years ago #
  2. you could put it in your child's theme folder and then

    for url use

    url : <?php echo get_bloginfo('stylesheet_directory'). "/process.php"; ?>,

    though this will not work if the file is in a .js file as it won't know how to process the php.

    or you could also take a look at
    http://codex.wordpress.org/AJAX_in_Plugins

    and for url use

    url: ajaxurl,

    and then

    add_action('wp_ajax_my_action', 'my_action_callback');
    
    function my_action_callback() {
    	global $wpdb; // this is how you get access to the database (if you need it)
    
    	$whatever = intval( $_POST['whatever'] ); //post is everything your form submitted
    
    	$whatever += 10;
    
            echo $whatever;
    
    	die(); // this is required to return a proper result
    }
    Posted 10 years ago #
  3. Tq helgatheviking,

    I have try but it seems not the solution... IT seems like wordpress didnt find the php files. It bring an error page as below

    "Not Found

    Apologies, but we were unable to find what you were looking for. Perhaps searching will help."

    __________________________________
    My Form inside the custom page.
    __________________________________

    "
    <form id="request_quotation" method="post" action="">
    <table>
    <tr>
    <td>Request From</td><td>

    <select name="company">
    <option value="test@mail.com">Ramzul Isyraf Enterprise</option>
    <option value="mr.ghazali@gmail.com">RajaLanun Manipulation</option> </select></td>
    </tr>
    <tr><td>Name</td><td><input type="text" name="name"/></td></tr>
    <tr><td>Date</td><td><input id="datepicker" type="text" name="date"/></td></tr>
    <tr><td>Description</td><td>

    <textarea name="desc" cols="18" rows="3"></textarea>
    </td></tr>
    <tr><td> </td><td><input type="submit" value="Submit" /></td></tr>
    </table>
    </form>
    "
    __________________________________
    My javascript call
    __________________________________

    "<script type="text/javascript">
    $j=jQuery.noConflict();
    $j("#request_quotation").bind("submit", function() {

    $j.fancybox.showActivity();

    $.ajax({
    type : "POST",
    cache : false,
    url : "http://demo.ghazalitajuddin.com/wp-content/themes /adverts/process.php",
    data : $(this).serializeArray(),
    success: function(data) {
    $.fancybox(data);
    }
    });

    return false;
    });
    </script>"

    Posted 10 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.