2

I have a function which is supposed to fire onclick which is just an ajax call to retrieve some product information & output it to the page. I want to use a value passed to the function as part of the url.

function getDetails(pCode)
{
var page = "includes/details.php?pCode= + pCode &success=yes";
}

I need the value of pCode to be passed to the script in order for the right information to be retrieved but I can't seem to concatenate the string correctly. I know this is basic but I would very much appreciate a nudge.

1 Answer 1

0

You do it this way.

function getDetails(pCode) {
  var page = "includes/details.php?pCode=" + pCode +"&success=yes";
}
Sign up to request clarification or add additional context in comments.

2 Comments

Could you possibly help me little bit further, when I click on an item in the product list it brings up product details i.e cost supplier etc which is the desired effect however on some products it brings up the previous version of the called php file despite that having been replaced!
@Ginelli As far your second question is concerned, ask it up as a separate question here and give me the link. May be more persons might be able to help you better than me, and I too will try to help you...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.