ajax request gets stuck

hi guys,

im pretty new to creating sites using ajax, and i've got an irritating problem.

i have a dropdown box which is dynamically populated from the name field in a mysql table.
when a entry from the dropdown is selected, about 10 text fields get populated with the rest of the information for that person.

my problem is that if a field is missing a value, it sort of gets stuck and just says "loading".

i can attach my code, if needed but off the top of your heads, can you think of a way around this?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi Jack

I would start by debugging your AJAX errors with Firefox browser and error console.  It should tell you where your errors are occurring in your script and on which line.

I would like to know which library you are using to implement AJAX and which language your using to code with, most errors are data problems, spaces can cause problems in data you retrieve and needs to be handled accordingly.

Yours sincerely

jack-lindsayAuthor Commented:
ok i just tried debugging using firefox error console and on a record i know "gets stuck" it says

Error: xmlDoc.getElementsByTagName("CUSTWWW")[0].childNodes[0] is undefined
Source File: "pathtofile.js"
Line: 38

from what i can tell it doesn't like empty fields.  and it doesn't continue the script if it see's an empty field.

im using php to talk to a mysql database.  and im not using any libraries, im just using snippets of code from help websites and editing them till it works.  i dont think any of my problems are do with spaces as other records have spaces and they appear fine.

Ok, so you need to write some error handling in your Javascript for those empty values.

Could I interest you in taking a look at PHP4SACK, I don't want you to waste your time on it but perhaps this library will help you get up to speed fast and I can help you with any debugging on it.


Otherwise you're going to have to post up some code so I can see what is happening.
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

jack-lindsayAuthor Commented:

i will definitely look into php4sack

i've also attached file files related to the issue.  hopefully you can make sence of my work.  if you have any other recommendation related to my code, im more than happy to receive them

Thanks, give me a chance to look into your files, meantime see if you can make sense of php4sack, its coded to run javascript in the return AJAX results which is useful in many situations.
jack-lindsayAuthor Commented:
found the problem in the end.  i put in the code that it could only echo the code if the field wasn't null.  as the field was null the problem occured

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jack-lindsayAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.