Support » Plugins » call ajax inside wordpress posts/pages

  • Sorry for this but I searched the whole web for a solution to my probleme but in vain 🙁

    What I want to achieve is creating a normal Post and adding a form to it that once submitted, goes to a database and gets back a value.

    I created a plugin for that and integrated it in the admin menu then set a function that queries the db :

    myfunc_getcode($db, $table, $value, $return) // returns a value

    how can I achieve this!? I mean, when a user inserts some data in the form (that exists inside a post or page) then he clicks on submit, Ajax talks to the db and gets the results back.

    I don’t even know if wordpress 3.0.1 allows such things!

Viewing 1 replies (of 1 total)
  • I got it to work by using

    add_action('the_content', 'my_function');

    this hooks my plugin to the posts and pages.

    then in the function I transmit the content like;

    function my_function($content) {}

    Then I used Ajax by integrating jquery inside my script;

    `<script type=”text/javascript”>
    jQuery(document).ready(function($) {}`

    for submitting forms I used jquery/ajax to listen to the form

    $("#my_form_id").submit(function() {

    and used jquery’s $.post to pass variables to a php page that handeles my results and returns them by echo.

    hope this helps someone!

Viewing 1 replies (of 1 total)
  • The topic ‘call ajax inside wordpress posts/pages’ is closed to new replies.