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.

EricSchaefer
  • 25,272
  • 21
  • 67
  • 103

1 Answers1

0

You do it this way.

function getDetails(pCode) {
  var page = "includes/details.php?pCode=" + pCode +"&success=yes";
}
Amit Joki
  • 58,320
  • 7
  • 77
  • 95
  • 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! –  Oct 05 '14 at 08:33
  • @Ginelli As far your second question is concerned, ask it up as a separate question [here](http://stackoverflow.com/questions/ask) 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... – Amit Joki Oct 05 '14 at 08:36