FoxPro Programming
problem with returning to web page
Gravatar is a globally recognized avatar based on your email address. problem with returning to web page
  Nechama
  All
  Jan 8, 2017 @ 11:54am

This part I didn't figure out yet.

In a webpage I have a dropdown menu that calls a jquery function.
The jquery function calls a webpage changesite.wp changsite.wp is a function that has VFP code in it.

If I select an option from the dropdown menu, the query code will run, then finish running the foxpro code from "changesite.wp", and then I get a blank page and the address box shows that it went to the webpage "changesite.wp".

How can I get it to remain in the screen that has the dropdown?

Thanks in advance.

Gravatar is a globally recognized avatar based on your email address. re: problem with returning to web page
  FoxInCloud Support - Thierry N.
  Nechama
  Jan 9, 2017 @ 05:25am

Can you post the jQuery code calling changesite.wp?

Gravatar is a globally recognized avatar based on your email address. re: problem with returning to web page
  Nechama
  FoxInCloud Support - Thierry N.
  Jan 9, 2017 @ 08:04am

Thank you for responding. Here is the code:

<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script>

function wlgsite(val)
{
	var whatever = val.substring(0, 5);
	if (whatever=='Chang'){
	location.reload();
	}else{
    window.location.href = "changesite.wp?id="+val;}
}

</script>

Gravatar is a globally recognized avatar based on your email address. re: problem with returning to web page
  FoxInCloud Support - Thierry N.
  Nechama
  Jan 9, 2017 @ 08:15am

you probably need an AJAX request:

function wlgsite(val)
{
	var whatever = val.substring(0, 5);
	if (whatever=='Chang'){
	location.reload();
	}else{
    jQuery.ajax("changesite.wp?id="+val, {success:function(response){process response;}});
    }
}

response is whatever changesite.wp returns in response.write()

Gravatar is a globally recognized avatar based on your email address. re: problem with returning to web page
  Nechama
  FoxInCloud Support - Thierry N.
  Jan 9, 2017 @ 08:42am

changesite.wp wasn't being called with:

jQuery.ajax("changesite.wp?id="+val, {success:function(response){process response;}});

So I just changed it to

    jQuery.ajax("changesite.wp?id="+val)

Which ran changesite.wp. However,

cId = Request.Params("id")

generates an error. "Operator operand type mismatch".

How do I get the value of "val"?

Thanks for helping me.

Gravatar is a globally recognized avatar based on your email address. re: problem with returning to web page
  FoxInCloud Support - Thierry N.
  Nechama
  Jan 9, 2017 @ 09:21am

process response was just a placeholder for whatever processing you'd need.

when error occurs, please choose suspend and inspect what happens in the VFP debugger.

what can you have in val?

Gravatar is a globally recognized avatar based on your email address. re: problem with returning to web page
  Nechama
  FoxInCloud Support - Thierry N.
  Jan 9, 2017 @ 09:22am

Actually. Sorry. It does work. It was another line of code causeing the error.

Again, thanks for your help.

© 1996-2024