Redirect to entity ID after entity create form submit with AJAX I have an AJAX entity create form and I want to redirect to that entity ID after I submit the form and create the entity, I know I can't use goto() because it's AJAX. I have the hook form alter for that entity already for some other customization of the form.
You should not use drupal_goto() for form redirects. You should set the redirect in the form state.

function mymodule_myform_submit($form, &amp;$form_state) {
  // other code
  $form_state['redirect'] = 'path';
}


Ctools provides a way to do a redirect in an AJAX callback, a function called ctools_ajax_command_redirect.

I found an example of someone using this function in a form callback that is AJAX:

function mymodule_custom_ajax_form_submit($form, &amp;$form_state) {
  //Close lightbox and redirect to the current page
  $path = $_SESSION['current_path'];
  ctools_include('ajax');
  ctools_add_js('ajax-responder');
  $commands[] = ctools_ajax_command_redirect($path);
  print ajax_render($commands);
  exit;
}


So, in your case, you would need to know the entity id in the submit handler, and you can get the uri with entity_uri, which you can pass as the $path and that should work. Just load the entity object, and pass it to entity_uri. It should return 'myentity/(id)' ex 'node/123', which you can redirect to.