Current location: Hot Scripts Forums » Programming Languages » PHP » AJAX problem with php dynamic url


AJAX problem with php dynamic url

Reply
  #1 (permalink)  
Old 10-27-06, 08:48 AM
scott2500uk's Avatar
scott2500uk scott2500uk is offline
Coding Addict
 
Join Date: Apr 2006
Posts: 275
Thanks: 2
Thanked 2 Times in 2 Posts
AJAX problem with php dynamic url

Im making a db that lists customers that have been time wasters so that people that work for me can check up on those clients. Now I decided to use AJAX when searching and displaying the results to save the whole page reloading. Now I'm very new to AJAX but know my PHP and MySQL coding very well. Here is my problem.

I have a file called modules.php and depending on its ?name= determines what module it loads. In my case for the time wasters modules it is:

modules.php?name=Time_Wasters

let me start by showing the files I have set up to do the job.

firstly is the file: modules.php?name=Time_Wasters
http://www.steezmatic-designs.com/he...searchform.txt

^^ this is just the form to do the search and display the result from the innerhtml that is gotten from the AJAX

Secondly is the AJAX script which is embedded in the above file:
http://www.steezmatic-designs.com/help-files/ajax.txt

and thirdly is the file that AJAX queries:
http://www.steezmatic-designs.com/he...searchfile.txt

Now this is my problem. I search the db for a know entry and click search. Hurray it shows the result correctly as it should but only a split second before the whole page redirects to modules.php and then the page shows nothing as there is no longer a ?name= bit on the url. For some reason when the innerhtml is displayed it seems to loose the ?name=Time_Wasters bit of the url

I'm sure there is something missing in my code that is causing this. Can some one please help me with this. Ive spent hours and hours trying to figure out why this is happening. Any help is greatly apreciated. Thanks guys
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 10-27-06, 08:59 PM
nova912's Avatar
nova912 nova912 is offline
Code Guru
 
Join Date: Sep 2004
Location: Traverse City, MI, USA
Posts: 821
Thanks: 0
Thanked 0 Times in 0 Posts
<input type=\"submit\" onclick=\"ajaxFunction()\" value=\"Search\">\n";

That is your proboem, you're submitting your search page.

<input type=\"button\" onclick=\"ajaxFunction()\" value=\"Search\">\n";

That should fix your problem.

Last edited by nova912; 10-27-06 at 09:03 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 10-28-06, 07:27 AM
scott2500uk's Avatar
scott2500uk scott2500uk is offline
Coding Addict
 
Join Date: Apr 2006
Posts: 275
Thanks: 2
Thanked 2 Times in 2 Posts
thx for that. well spotted. This is what I hate about coding is that the most simplest things cause the whole lot not to work.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 10-28-06, 11:33 AM
nova912's Avatar
nova912 nova912 is offline
Code Guru
 
Join Date: Sep 2004
Location: Traverse City, MI, USA
Posts: 821
Thanks: 0
Thanked 0 Times in 0 Posts
I knew it before i even looked at your code when i saw this...

"Hurray it shows the result correctly as it should but only a split second before the whole page redirects to modules.php"


This toled me your AJAX is working, it's something more basic causing the issue.


Glad it's working =)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[For Hire] Php, Mysql, ASP, AJAX, DHTML programmer t_narendra Job Offers & Assistance 0 09-01-06 02:25 AM
Change this AJAX script to accomidate dynamic url arandlett JavaScript 3 06-14-06 04:01 AM
PHP email form problem jcwilde1 PHP 2 06-19-05 12:19 AM
PHP script problem (please help) osmanmumtaz PHP 0 05-24-05 08:29 AM
php variable problem ashishjha54 PHP 7 05-22-05 01:09 PM


All times are GMT -5. The time now is 06:53 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.