View Single Post
Old 03-14-2012, 06:00 PM   PM User | #2
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
ok first off, you are already loading the jquery framework so you dont need that old script you added to load pages using ajax.

then you can replace :

Code:
ajaxpage('/staffpanel/_frontend/requests.php', 'request')
with:

Code:
$("#request").load('/staffpanel/_frontend/requests.php')
even then, you are still loading an entire webpage into another one. PHP has a way to response with everything in the body element of a page if being requested by ajax, but I dont knwo how to do it.

then , also, you would need to include the css from requests.php. best way is using an external css file

after all that is handled,

here is an example of what you are looking for:


Code:
$(function () {
    $("#idofrequestform").live("submit", function (e) {
        e.preventDefault(); //prevernt default form sumbit action
        var SubmitURL = "/staffpanel/_frontend/requests.php";
        var dataString = $('#responseForm').serialize();
        $.ajax({
            type: "POST",
            url: SubmitURL,
            data: dataString,
            success: function () {
                alert("request sent!")
            }
            return false;
        });
    });
you would put that right after the .load code
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote